SqlShare.com Logo
 
Skip Navigation Links
Home
Video List
Events
Classes
About Us
Login / Register
Subscribe RSS Feed 

Confio Ignite

Using TOP in Queries

It's easy to use and powerful, but did you know the syntax is slightly different when you use it for an insert, update, or delete statement? It's a cleaner alternative than SET ROWCOUNT, make sure you know how it works!

Duration:
3 mins 1 secs
Skill Level:
100
Rating:
4.38 out of 5
Publish Date:
January 06, 2010
Using TOP in Queries You must be logged in to view this video.  
Bookmark and Share
 
1=Poor, 3=Good, 5=Excellent

About the Author

Image of Andy Warren
Andy Warren is a software trainer focusing on SQL Server, a member of the PASS Board of Directors, and a principal in this site - SQLShare.com.

References

There are no downloads or recommended reading links for this video

Comments
Thomas Kaiser on 1/6/2010
Excellent

Denise Tsubota on 1/6/2010
Very clear and informative

Christian Bahnsen on 1/6/2010
Thanks. I'm definitely going to get in the habit of always using parentheses when using TOP

Nancy on 1/6/2010
very useful....in summary use the (), then it doesn't matter

Vagner on 1/6/2010
I thing that another point to comment out is about using top. Because for what I know, the top behind the scenes does a select * and then gets the quantity of rows you want.

nilanaksha on 1/6/2010
Thanks a lot for this demo....

Subir on 1/6/2010
Superb....Subir Sankar Das, Sr. Software Engineer

Jukka Nevalainen on 1/7/2010
three minutes about parenthesis usage! huh!

Phil Gainer on 1/7/2010
Very Timely. I need to develop an web app to update 8,000+ items and I don't want all 8,000+ to appear in the update grid every time I run the query.

Steve Hicks on 1/7/2010
quick, clearn, and to the point.

steve on 1/7/2010
As always, good info and examples. thanks Andy

Bart Hayes on 1/7/2010
Short, sweet and to the point.

Don Weigend on 1/7/2010
I have use "top" in many, many queries but I did not know that the parenthesis were required when top is used in an update or delete statement. Thanks for the tip!

Peter Voutov on 1/7/2010
I would have thrown in a 30 second mention of set rowcount as the old school alternative to using top (@X) where @X is a variable for people not on SQL 2005.

17024408B3 on 1/7/2010
Was very basic.

Travis on 1/8/2010
These kind of simple videos are good for eighth graders trying to learn SQL. Way too basic IMHO.

A Alagu Ganesh on 1/8/2010
Good

pavankumar on 1/9/2010
I want more about to key word

pavankumar on 1/9/2010
nice

manu jaidka on 1/18/2010
Liked it..

Bom

Catto on 5/11/2010
Hey Now Andy, Top vid is great! Thx 4 the info,

Derek on 11/23/2010
Good stuff.

Kyran on 12/10/2010
Quick clear and to the point. very good.

prakash on 12/10/2010
This video is really good explainatory.

Todd Burrell on 12/10/2010
Great stuff, especially pointing out the requirement for the parentheses on the select query using the parameter.

Michael Miller on 12/10/2010
Parenthalicious!

A43036427E on 12/10/2010
I've used TOP a few times in Selects but I didn't know you could use it in Update nor did I know about the parentheses. Thanks!

Mark on 12/10/2010
clar and consic

A43036427E on 12/10/2010
I saw the video on TOP this morning and to my surprise I found a use for the parentheses with a parameterized TOP number a few hours later. Nice coincidence, and thank you.

R Michael Lacy on 12/10/2010
No copy of demo script today?

Nilesh on 12/10/2010
good

Tcharly Florestal on 12/10/2010
Excellent

Stephanie Brown on 12/10/2010
I would not have guessed that TOP worked that way. Really good information.

Jeannine on 12/10/2010
great voice and pacing!!

Russell Tye on 12/12/2010
Great explanation!!!

Mat on 12/12/2010
good simple tip

7F718A6344 on 12/17/2010
How do you get rid of the results pane with just a click?

58039FCE90 on 1/5/2011
several examples weren't useful

Scott on 4/19/2011
The purpose of the parentheses wasn't explained.

Maurice Ivory on 7/15/2011
I will use the 'TOP' function in my next code.



Must Be Logged In
 

How Do I Become a Video Author? |  Newsletter History

Copyright © Fourdeuce, Inc., 2005-2009. All Rights Reserved | Privacy Policy | Terms & Conditions