30259747@qq.com 发表于 2017-6-16 17:13:25

UAP存储过程建查询报表参数多值时,查不出内容。

各位高手,小弟写了有一个存储过程,查询条件这where in (@参数多值),在UAP报表中查询选择多个会显示不出来内容;选择一个值时是可以查出内容。但是SQL中通过EXEC参数=‘多值’时,是可以查出内容,请问是UAP中查询条件设置的问题的吗?以下参数动态内容,查询内容略。
creat procedure . @date1 datetime,@date2 datetime,@cPsn_Name varchar(20)='',@cInvStd varchar(30)='',@cInvDefine4 varchar(20)='',@cWhCode varchar(200)
as
Declare @Table_NameList table ( Name Varchar(20))-- 建立表变量
Declare @Index_Param int   /*参数 记录分隔符的位置*/
Declare @NeedParse varchar(500) /*参数 没有处理的字符串*/

Select@Index_Param=CharIndex(',', @cWhCode)
   if (@Index_Param=0)
begin      /*一个名字组成*/
         insert into @Table_NameList (Name) values(@cWhCode)
   end
else   /*存在多个名字*/
         begin
            set @NeedParse =@cWhCode
            while (CharIndex(',', @NeedParse)>0)
                  begin
                           insert into @Table_NameList (Name) values(SubString( @cWhCode,1,CharIndex(',', @cWhCode)-1))
                         set @NeedParse =SubString(@NeedParse,CharIndex(',', @NeedParse)+1,len(@NeedParse)-CharIndex(',', @NeedParse))
             end
         insert into @Table_NameList (Name) values(@NeedParse)
   end



select * from*
wheret1.cWhCode in (select Name from @Table_NameList)
页: [1]
查看完整版本: UAP存储过程建查询报表参数多值时,查不出内容。