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.
| Author |
Topic |
|
sqldbhl
Starting Member
3 Posts |
Posted - 2009-10-13 : 05:13:52
|
| Hello,I have the following sql query to select rows between 200 and 300 from a table provided the table has an identity column called id:SELECT TOP 100 * FROM TableName where id not in (select top 200 id from TableName)I need to select rows between 200 and 300 from a table without knowing any column names.I tried the following sql query:SELECT TOP 100 * FROM TableName where * not in (select top 200 * from TableName)But it didn't work. Does any one know a solution?Thanks in advance. |
|
|
sanoj_av
Posting Yak Master
118 Posts |
Posted - 2009-10-13 : 05:23:05
|
| Select TOP 300 * from TableName EXCEPTSelect TOP 200 * from TableName Note: The records between 200 and 300 according to the identity column is not guaranteed as long as you do not specify the id column in the order by clause. |
 |
|
|
sqldbhl
Starting Member
3 Posts |
Posted - 2009-10-13 : 05:36:52
|
| Thank you very much for your reply. |
 |
|
|
|
|
|