C
cxz9
Unregistered / Unconfirmed
GUEST, unregistred user!
请问能不能将'11','222'作为一个参数传递给存储过程。''11'',''222''好像不行的
if @strs<>''
begin
这儿打出来是对的但就是不能执行。
--print 'select xh,tdh from tdzxd where tybh in ('+@strs+')'
if (@st='TY')
begin
declare xh_cur cursor for select xh,tdh from tdzxd where tybh in (@strs)
select @m=count(distinct cs) from tdzxd where tybh in (@strs)
end
else if (@st='BL')
begin
declare xh_cur cursor for select xh,tdh from tdzxd where tdh in (@strs)
select @m=count(distinct cs) from tdzxd where tdh in (@strs)
end
else if (@st='CN')
begin
declare xh_cur cursor for select xh,tdh from tdzxd where xh in (@strs)
select @m=count(distinct cs) from tdzxd where xh in (@strs)
end
--print @runs
--exec (@runs)
--WAITFOR DELAY '000:00:01'
open xh_cur
fetch next from xh_cur into @xh,@bl
while @@fetch_status=0
begin
if (@xh<>'') and (charindex(@xh,@xhs)=0)
set @xhs=@xhs+''''+@xh+''','
-- if @bl<>''
if (@bl<>'') and (charindex(@bl,@bls)=0)
set @bls=@bls+''''+@bl+''','
fetch next from xh_cur into @xh,@bl
end
close xh_cur
deallocate xh_cur
这样也不行
begin
set @runs='declare xh_cur cursor for select xh,tdh from tdzxd where xh in ('+@strs+')
select @m=count(distinct cs) from tdzxd where xh in ('+@strs+')
go'
end
--commit tran
print @runs
exec (@runs)
--WAITFOR DELAY '000:00:01'
open xh_cur
fetch next from xh_cur into @xh,@bl
while @@fetch_status=0
begin