Using the vs2008 query builder, I’m trying to make a query that gets a parameter for the “TOP” Command, and then I face an error “Error in top expression”
Works:
SELECT TOP 5 * FROM dbo.SomeTable
WHERE SomeColumn = SomeValue
Doesn’t Work:
SELECT TOP @param1 * FROM dbo.SomeTable
WHERE SomeColumn = SomeValue
alt text http://www.freeimagehosting.net/uploads/f9b9354577.jpg
Need parenthesis, and only for SQL Server 2005 and above