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

Overview of MVC

SOLID Principles with C#

Auto Sequence Number in Grid Control with Paging

Parsing the comma separated values into a temporary table

Applying Dynamic Themes to WebPage

Send Email using Gmail SMTP server - ASP.NET

MVC Request Execution Stages - Life Cycle

How to Update Dependent Excel Cells Automatically

Introduction to ASP.Net MVC