• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

MS SQL

so..i couldn't help but notice when trying to write queries for microsoft's database implementations that there is no LIMIT command. whats the deal with that? The closest I could find was using TOP <number> after select. For example:

SELECT TOP 10 *
FROM myTable
WHERE myField = 'some value';

as opposed to:

SELECT *
FROM myTable
WHERE myField = 'some value'
LIMIT 10;

Microsofts version works fine and dandy, until you need to do something like limit the range of results from say 10 to 20

Is there a way to do the same thing with microsoft's implementation of SQL?

Is Microsoft once again not abiding by ANSI standards, or is the LIMIT feature just something that's specific to MySQL?
 
select top 10 from foo where key not in (select top 10 from foo)

That's how I've always done it (with appropriate order by clauses, of course).
 
sql 2005 supports what oracle has had for a while--the concept of a rownum. you can base your queries off of it to limit your range. i don't remember what it was called though.
 
Back
Top