eid empname eaddress ---- -------- --------- 1 venu hyd 2 ravi mad 3 kiran ban 4 raju hyd
If firstrow in empname column is venu then it has to change all the empname columns values to 'venu' like below table
eid empname eaddress ---- -------- --------- 1 venu hyd 2 venu mad 3 venu ban 4 venu hyd
If firstrow in empname column is NULL then it has to take the 2nd row value and change all empname columns values to 2nd row value i.e 'ravi' like below table
eid empname eaddress ---- -------- --------- 1 null hyd 2 ravi mad 3 kiran ban 4 raju hyd
EXAMPLE
eid empname eaddress ---- -------- --------- 1 ravi hyd 2 ravi mad 3 ravi ban 4 ravi hyd
UPDATE MyTable SET empname = (SELECT TOP 1 empname FROM MyTable WHERE empname IS NOT NULL ORDER BY eid ASC)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)