SQL存储过程中用Exec(@strsql)如何给里面的变量赋值?

如题所述

第1个回答  推荐于2016-12-03
create proc fuction_View
@count int
as
declare @strsql nvarchar(1000)
declare @s_id int
@strsql ='select top 1 @id=s_id from (select top ' + @count + ' s_id from PageIndex order by s_id ) aa order by s_id desc'
execute sp_executesql @strsql,N'@id int out',@id=@s_id out
go
本回答被提问者采纳
相似回答