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 |
romeck
Starting Member
16 Posts |
Posted - 2013-09-09 : 22:36:20
|
Hi i have tableid, series, seriesnrand data 65557,AS,074443,AS,0how to update table so seriesnr would be incremental , like 65557,AS,174443,AS,2if i use update x set seriesnr=select max(seriesnr) from xthen i got same seriesnr for all rows like max was calculated only one time on the begining not on each row update(why is that itseem so illogical)65557,AS,174443,AS,1THQ |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-09-10 : 00:47:14
|
update TSET seriesnbr = RNfrom (SELECT *, ROW_NUMBER() OVER(PARTITION BY series ORDER BY id) RN FROM TableName) T--Chandu |
 |
|
|
|
|
|
|