update sql column with same data but with a little modifications to it
I have a sql DB table columns which carries data in "0000-00-0000" format. For ex: "8753-11-2010"
Now i need开发者_开发百科 to change this value from "8753-11-2010" to "008753-0011-2010" i.e. i need to pad "00" in front of "8753" and "11" i mean the first two strings u can call it.
please advise how i can achieve this in sql server 2005. I need to do this for more then 200 rows.
thanks
update YourTable
set YourCol = '00' + STUFF( YourCol,6,0,'00')
WHERE YourCol LIKE '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'
精彩评论