declare @num int, @sqls nvarchar(4000)
set@sqls='select @a=count(*) from tableName '
exec sp_executesql @sqls,N'@a int output',@num output
select@num
详细参见:http://www.cnblogs.com/zhhe0800/archive/2011/07/21/2113346.html
declare @num int, @sqls nvarchar(4000)
set@sqls='select @a=count(*) from tableName '
exec sp_executesql @sqls,N'@a int output',@num output
select@num
详细参见:http://www.cnblogs.com/zhhe0800/archive/2011/07/21/2113346.html