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 |
Vack
Aged Yak Warrior
530 Posts |
Posted - 2014-07-02 : 15:45:22
|
I have data below that is not validating against an index I want to put on the table. Index is on the four fields below. Looking for a script that will re sequence the line_no field by inv_noord_no line_no item_no inv_no 123 1 ABC 777 123 1 ABC 778 123 1 ABC 778After running script data should look likeord_no line_no item_no inv_no 123 1 ABC 777 123 1 ABC 778 123 2 ABC 778 update oelinhstset line_no = ???? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-02 : 15:59:31
|
select ord_no, row_number() over(partition by inv_no order by ord_no) as line_no, item_no, inv_no from yourtableTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|