Uncategorized

Maintain an ordinal column

I need to maintain a column that stores a sort order partitioned by a parent record foreign key. The column should be the contiguous counting numbers and should automatically renumber the records when the sort order is changed for one record. Here’s what I have so far: CREATE TABLE SalesOrder ( SalesOrderKey INT IDENTITY(1,1) NOT […]