Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SELECT TOP 1

Author  Topic 

sasan_vm
Yak Posting Veteran

51 Posts

Posted - 2012-04-27 : 04:53:25
Hi,

I want to select 1 record in table with million records, in condition
section use unique index to select record. Is any different to use SELECT vs SELECT TOP 1:

SELECT * FROM [table_name] WHERE [unique_field] = @param

vs

SELECT TOP 1 * FROM [table_name] WHERE [unique_field] = @param


Regards,
sasan.

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-04-27 : 06:28:32
No

- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page

vinu.vijayan
Posting Yak Master

227 Posts

Posted - 2012-04-28 : 07:39:24
Both queries are same. Check the Execution plans and Statistics to know for yourself.

N 28° 33' 11.93148"
E 77° 14' 33.66384"
Go to Top of Page
   

- Advertisement -