SQL存储过程中用Exec(@strsql)如何给里面的变量赋值?
展开全部
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
@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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询