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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-23 : 09:57:11
|
| Biplab writes "How do I get 10th, 11th and 13th record by using SELECT Statement when i don't have any identity/primary column in a table? ORHow do I get 10th to 13th record by using SELECT Statement on same condition?" |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2002-08-23 : 10:43:51
|
| Rows are not in any order that can be relied upon in a SQL database. They can change every time you select them. It's magic.Consider altering the table to include a column [RowNum] of type INT and number the rows yourself.It may be better to add a primary key column.There are examples of how to create a procedure that will fill a column with sequential numbers on this site. You may want to examine the paper on "Deleting duplicate records" to get some ideas.SamC |
 |
|
|
KHeon
Posting Yak Master
135 Posts |
Posted - 2002-08-27 : 14:36:44
|
| While I've done this with primary keys. In the past what I do is create a temp table which has a RowNum field in it that is also an IDENTITY field which increments with each record insert. After this you need to pull the least amount of data and records (in the order you want them, but the primary key is the most accurrate) into the temp table and then join the temp table with the original table(s), and specifying in the WHERE the the RowNum values.Kyle HeonPixelMEDIA, Inc.Senior Application Programmer, MCPkheon@pixelmedia.com |
 |
|
|
|
|
|