I have a table named Table1 which has a varchar, named Col1. I want to create a Table2 and add a leading "0" in front of the contents of Col1.
How can I add a zero character to the front of a varchar? I have tried several ways but none seems to work.
Following query will create table2 with leading "0" for col1.
select '0' + Col1 Col1 into table2
from table1
If table2 is already created and you want to just populate data.
insert into table2(Col1)
select '0' + Col1
from table1