Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TOP cannot be a parameter
Message
From
30/05/2007 14:35:05
 
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01229408
Message ID:
01229413
Views:
16
Hi, Glenn,

Prior to SQL '05, TOP N cannot be a variable. You'll need to use dynamic SQL....OR...you can set the @ROWCOUNT value and then set it back after the query. Check @RowCount in books on line for details.

In SQL '05, TOP N can now be a true variable....you can do

SELECT top (@PageSize)

Hope that helps...
Kevin
Previous
Reply
Map
View

Click here to load this message in the networking platform