Monday, March 12, 2012

How to return only the first row....

Is there a way to return only the first row of a multi-row query. In other words... I have a query returning multiple rows but I want it to stop after it retrieves the first row.
ThanksIn Oracle you would add

AND ROWNUM = 1

to the WHERE clause

-- rajXesh|||Thanks rajXesh!|||Is there a similar command for SQL Server?|||Originally posted by acg_ray
Is there a similar command for SQL Server?

SELECT TOP 1 * FROM [table]|||Thx Joel. That did it.

No comments:

Post a Comment