关于sp_executesql的有关问题
关于sp_executesql的问题DECLARE @count INT , @SQL varchar(max) SET @count 10 SET @SQL SELECT TO
关于sp_executesql的问题
DECLARE @count INT , @SQL varchar(max)
SET @count = 10
SET @SQL = 'SELECT TOP ' + @count + ' FROM testtable'
EXEC(@SQL)
[解决办法]declare @sql Nvarchar(100)
set @sql='select top (@count) ID from testtable'
exec sp_executesql @sql,N'@count int',@count='10'
[解决办法]declare @sql Nvarchar(100)
set @sql='select top (@count) ID from testtable'
exec sp_executesql @sql,N'@count int',@count='10'