Saturday, December 16, 2006

FAQ : How to Parameterize TOP clause in SQL Server 2000

CREATE PROCEDURE spTopRecords
@Top int
as
-- set how many records to return
SET ROWCOUNT @Top
SELECT * FROM
SET ROWCOUNT 0

Note : In SQL Server 2005 top can be used with varaiable

declare @i int
set @i=10
Select top(@i) * from sysobjects

No comments:

 
Locations of visitors to this page