好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

动态的调用输出查询语句中的值 execute sp_executesql

sql语句,参数 ,变量=@count output 例:

declare @ exec_sqlCount nvarchar ( 1000 )

declare @ count int

set @exec_sqlCount = ‘select @count=sum(t.a) from t ‘

declare @scon nvarchar ( 100 )= ‘@count int output‘ --定义一个输出参数
execute sp_executesql @exec_sqlCount , @scon , @count = @count output --执行

--很多时候查询的时候不能将查到的值带出,所已可用该方法。。

动态的调用输出查询语句中的值 execute sp_executesql

标签:

查看更多关于动态的调用输出查询语句中的值 execute sp_executesql的详细内容...

  阅读:35次