Leading 0s get eliminated while opening the CSV file in excel after writing to CSV

Hi All…
Thanks …

I found a way to resolve this and thought of sharing ,it may help others.

If we add a TAB +convert(VARCHAR(10),Char(9)) at the end of the column value then it will not eliminate leading zeroes when csv is opened in excel and will not add qoutes as well when opened in notepad.

I did this from the sql side.

Thanks and Regards,
Geetishree Rao

2 Likes