日期:2014-05-18  浏览次数:20437 次

帮我看看用EXEC命令执行的值返回给变量,这样写对吗??
declare   @recordcount   int
declare   @str   nvarchar(500)
set   @str   =   N 'select   @recordcount   =   count(*)   from     [ '+@ToDbName+ '].[dbo].[ProjectInfo] '
exec   sp_executesql   @str,   N '@recordcount   int   output ',   @recordcount   output
if   (@recordcount   =0)
..........

------解决方案--------------------
U r right.