Getting Top N Rows in SQL2K and SQL2K5 [Non Tech Ppl Plz Excuse]

SQL 2K

declare @topN int

set @topN = 10

set rowcount @topN

select * from [TABLE]

/***************************/

SQL 2K5

declare @topN int

set @topN = 5

select top (@topN) * from [TABLE]

Comments

Popular posts from this blog

Page Life Cycle in ASP.NET

MVC Request Execution Stages - Life Cycle

SQL Server 2005 with XML Parameters

Polymorphism in C#

LINQ - C# Programming

Abstract Class and An Interface

Differences between a Structure and Class

Variable Value in Top Statement

Auto Refresh .aspx page - ASP.NET