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 - 2005-04-21 : 08:01:04
|
| Kassim writes "Declare @Rowno Numericset @Rowno =0Update testdata Set @Rowno = Rowno = @Rowno+1 From testdataorder by PositionI would like to Update rows in sequence 1,2,3....NOrder by Position, above query works with out order by position,but it work get the rowno in sequence. Can you help me in getting the row in sequence by ordering position .regards,Kassim." |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-04-21 : 08:03:03
|
| You can't include ORDER BY in an UPDATE statement. The only way to accomplish what you're doing is to have a clustered index on the Position column.It would help if you posted the exact table structure (CREATE TABLE statement), some sample data, and the results you want to get. |
 |
|
|
|
|
|