Click here to Skip to main content
16,005,058 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have table name T1
and values are as follows:-
SQL
Name
---
A
Null
Null
B
Null
Null

How to update like this
SQL
Name
-----
A
A
A
B
B
B
Posted
Updated 23-Apr-15 0:49am
v2
Comments
Maciej Los 23-Apr-15 3:13am    
Is there any Primary Key?
DINESH K MAURYA 23-Apr-15 6:49am    
No

1 solution

There doesn't seem to be a real condition. The values are presented in no particular order and now you just assign the last non null value to any null value up until the next non null value.

By the way, if name is the only column without any other columns or index there really isn't any need to duplicate the values. A single A and B is enough. The other rows simply have no meaning and can be removed.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900