给个example to you:自己研究吧
CREATE proc test
@int_max varchar output
as
DECLARE @sql varchar(300)
set @sql='select max(no) into'+@int_max+' from test' --传递一个变量
exec(@sql)
set @sql=@int_max
print(@sql)
create procedure test
as
declare @i int
select @i=2
while @i>0
begin
select @i as i into #Temp
select * from #Temp
drop table #Temp
select @i=@i-1
end
go
This command did not return data, and it did not return any rows