I've a requirement to spool the sql results into an excel file. I've used this methodology to do so.
SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF;
SPOOL c:\my_test.xls
SELECT * FROM EMP;
SPOOL OFF;
The issue is there is a column in the table with leading zeroes like 053040 or 003455. When I double click the file in the excel the leading zeroes are trimmed and presented as 53040 or 3455.
Is there any way to retain the leading zeroes as well.
I've tried two solutions.
1. Adding a single quote to the column; when opened in excel its shows like '053040 or '003455
2. spool the results into the text file and open the text file in excel by data import wizard and make the needed column to text.
In the first point ' is visible and user is not OK with it..and the second point is having some steps to performed.
Is there any other way to do it.??
Thanks