SyntaxFix
Write A Post
Hire A Developer
Questions
Its also possible to use dynamic SQL and execute it with the exec command:
declare @sql nvarchar(200), @count int set @count = 10 set @sql = N'select top ' + cast(@count as nvarchar(4)) + ' * from table' exec (@sql)