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 |
|
CrazyT
Yak Posting Veteran
73 Posts |
Posted - 2010-04-12 : 17:23:29
|
| i have a stored procedure where Im selecting records to return like soSELECT ID, Field1FROM (SELECT ROW_NUMBER() OVER (ORDER BY ID) AS Row, ID, Field1 FROM table1) AS table1WHERE Row between @Start and (@Start + @NumberOfRows)I have another field called InProgressHow do I update the InProgress field when Im selecting the other 2 fields |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-04-13 : 02:15:49
|
Maybe I misunderstood butyou can do the update first with the same conditions and then do the select. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
CrazyT
Yak Posting Veteran
73 Posts |
Posted - 2010-04-13 : 11:33:41
|
| i was worried about messing up the results returned from the stored procedure.that should work. thanks |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-04-14 : 02:14:51
|
welcome No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
DBA in the making
Aged Yak Warrior
638 Posts |
Posted - 2010-04-14 : 05:10:46
|
| If you're using SQL 2005 or higher, you can use the OUTPUT keyword with the update statement, which will select the records updated.------------------------------------------------------------------------------------Any and all code contained within this post comes with a 100% money back guarantee. |
 |
|
|
|
|
|