SQL: Select Top X
I do a lot of work with identity, and it’s very common to be connecting to an Oracle, Microsoft SQL, and sometimes even MySql databases . . . all in the same project.
What I do with SQL in these instances is so basic it really doesn’t matter. Usually it’s just a glorified CSV file. However there is one SQL statement I use on a regular basis that isn’t standard between any of the three SQL engines. (thanks to Thea Burgers Blog for putting this information all in one place):
SQL Server:
SELECT TOP 10 * FROM table
ORACLE:
SELECT * FROM table WHERE ROWNUM <=10
MYSQL:
SELECT * FROM table LIMIT 10
Time for a little standardization?
Steve Evans has worked in the IT field for over 12 years, specializing in Microsoft technologies. He has consulted for small businesses on their IT infrastructure needs as well as worked for larger companies as a Systems Engineer. Steve has been a recipient of the Microsoft Most Valuable Professional (MVP) award for the past 3 years, and is a Technical Speaker at various industry events.







February 13th, 2008 at 7:23 pm
I think I understand a few words on this page, but, then again, I am not entirely sure.