SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SELECT TOP 1
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sasan_vm
Starting Member

48 Posts

Posted - 04/27/2012 :  04:53:25  Show Profile  Reply with Quote
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

Norway
3241 Posts

Posted - 04/27/2012 :  06:28:32  Show Profile  Reply with Quote
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

India
227 Posts

Posted - 04/28/2012 :  07:39:24  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000