ID S-No ____ ____ 1 1 ____ ____ 2 2 ____ ____ 3 Null ____ ____ 4 Null ____ ____ 5 3 ____ ____ 6 Null ____ ____ 7 Null ____ ____ 8 Null ____ ____ 9 Null ____ ____ 10 Null ____ ____ 11 4 ____ ____ 12 Null
ID S-No ____ ____ 1 1 ____ ____ 2 2 ____ ____ 3 2 ____ ____ 4 2 ____ ____ 5 3 ____ ____ 6 3 ____ ____ 7 3 ____ ____ 8 3 ____ ____ 9 3 ____ ____ 10 3 ____ ____ 11 4 ____ ____ 12 4
UPDATE MyTableName a SET [S-No] = (SELECT MAX([S-No]) FROM MyTableName b WHERE b.Id < a.Id AND b.[S-No] IS NOT NULL) WHERE [S-No] IS NULL
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)