I have a table like this:
Item Code
A 123456
B 123455
C 23457
D 123458
E 23459
F
The Code
column must have 6 characters and I need to add '1' (for example, 23455
to 123455
) for those items with less than 6 characters.
How can I do it with SQL ?
Thanks,
Update table
set Code = CONCAT( '1', TRIM( Code ) )
where LEN( TRIM( CODE ) ) < 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With