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 |
|
taylo
Yak Posting Veteran
82 Posts |
Posted - 2002-06-10 : 00:22:31
|
| Does anyone know how to go about selecting the prev/next record in the database?For example I am at record #100. I process it.Now I want to get record 99 and 101. Obviously if records nenver got deleted this would be simple. I need a sure fire way to get the Prev/Next Identity records.Thanks,Rob |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2002-06-10 : 00:51:49
|
| How about this for the next one:SELECT TOP 1 *FROM TableNameWHERE RecNum > 100Order By RecNum ASCand this for the previous one:SELECT TOP 1 *FROM TableNameWHERE RecNum < 100Order By RecNum DESC===============================================Creating tomorrow's legacy systems today.One crisis at a time. |
 |
|
|
taylo
Yak Posting Veteran
82 Posts |
Posted - 2002-06-10 : 00:56:25
|
| You know I was going to try that...... |
 |
|
|
|
|
|