Results 1 to 1 of 1
-
04-03-2010, 06:34 PM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,175
- Thanks
- 744
- Thanked 699 Times in 550 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Top N Rows by Variabls MS SQL 2005+
If you need to get top N rows by a variable that holds number of rows, this is how you can get it done in MS SQL 2005 or above:
Code:declare @N int set @N = 5 Select Top (@N) * from dbo.MyTable
Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK
Similar Threads
-
Connecting Coldfusion MX7 to SQL Server 2005
By Abina in forum ColdFusionReplies: 1Last Post: 02-02-2010, 11:26 AM -
dating software in Asp.net sql server 2005
By nandhisri in forum TemplatesReplies: 0Last Post: 10-23-2009, 04:12 AM -
SQL Server 2005 Express Import/Export Functionality Not Found
By manik in forum DatabasesReplies: 2Last Post: 09-18-2009, 12:32 PM -
Start and Stop MS SQL Server 2005
By manik in forum Windows ServerReplies: 0Last Post: 09-15-2009, 06:30 PM -
Data Import Export with Microsoft SQL DTS
By manik in forum DatabasesReplies: 1Last Post: 06-26-2009, 09:05 AM


Reply With Quote

