use pubs go declare @count int declare @sql nvarchar(4000) set @sql=‘select @count=count(*) from titles‘ exec sp_executesql @sql,N‘@count int output‘,@count output --请注意字符串前一定要加N select @count as [行数] go
2024-01-07 08:00:34
use pubs go declare @count int declare @sql nvarchar(4000) set @sql=‘select @count=count(*) from titles‘ exec sp_executesql @sql,N‘@count int output‘,@count output --请注意字符串前一定要加N select @count as [行数] go