declare @table
set @table = 'tbl'
declare @i int , @sql nvarchar(2000)
select @sql = 'select @i = count(*) from ' + @table
exec sp_Executesql @sql , N'@i int out',@i output
print @i
动态语句返回参数
最新推荐文章于 2024-11-13 11:37:20 发布
declare @table
set @table = 'tbl'
declare @i int , @sql nvarchar(2000)
select @sql = 'select @i = count(*) from ' + @table
exec sp_Executesql @sql , N'@i int out',@i output
print @i