Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
techadv
Starting Member
2 Posts |
Posted - 2010-03-01 : 23:15:54
|
hi all,I was hoping someone can help me out with a query, or at least point me in the right direction.There is an "item code" column in one of my tables, and I need a query which will add a "zero" into the 3rd position of each codeOLD CODE: 12345NEW CODE: 120345Is this possible to do with a query? Thanks in advance.Cheers ~ |
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-03-01 : 23:28:54
|
[code]UPDATE table_nameSET CODE = SUBSTRING(CODE, 1, 2)+ '0' + SUBSTRING(CODE, 3, LEN(CODE))[/code] |
 |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-03-01 : 23:29:38
|
Try Stuff function:Select Stuff(12345,3,0,'0')Regards,Bohra |
 |
|
|
|
|