>I have a brain block this AM
>This table contains transactions on sales orders that must be serialized in a seq column (int) by adddate (datetime) within sales order order sono (char).
>So, if a sales order has 10 transactions the seq column must be 1,2,3, etc in ascending order by adddate.
>Because of insertions, deletions, etc, I need to be able to reserialize the transactions for a given sales order with a tsql command(s).
>Can anyone unbock my brain?
UPDATE YourTable SET YourColumn
FROM YourTable
INER JOIN (SELECT SoNo, AddDate, ROW_NUMBER() OVER (PARTITION BY Sono ORDER BY AddDate) AS RowNum
FROM YourTable) Tbl1
ON YourTable.SoNo = Tbl1.Sono AND
YourTable.AddDate = Tbl1.AddDate
NOT TESTED!!!!!!
Make a good backup before trying it :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.