Monday, March 12, 2012

getting only the first occurance of a sql select statement

I am making a sql query and its bring back hundreds of results but I only need the first one. I am aware that getting the first one will be faster as well. Is there an efficient way to do this?Assuming you are using SQL 2000 or earlier:SELECT TOP 1 *
FROM dbo.sysobjects-PatP|||Assuming you are using SQL 2000 or earlier:SELECT TOP 1 *
FROM dbo.sysobjects-PatP

Don't forget an ORDER BY clause or your results may be unpredictable.

Regards,

hmscott

No comments:

Post a Comment