![]() |
BCP Insert Into Excel
I haven't worked with bcp exports, but the simplest thing to do is to export
the data with a leading single quote. I think that is probably the only way you are going to get Excel to recognise it as having leading zeros, anyway. If you can handle it from bcp directly, great, otherwise create a new view based on your underlying data with a field that adds a leading quote to your data. e.g. CREATE View ForExport as select char(39) + MyField, MyOtherField from my_table GO Robin Hammond www.enhanceddatasystems.com "UNOTech" wrote in message ... I have a BCP statement in SQL Server that exports to an excel document. A couple of the columns are numbers stored as text because they can have zeros as the lead digit, such as 0012345. However, when this imports into excel, it gives it a "General" format, which changes is to numeric, truncating the first 2 zeros. How can I get it to stop doing that as it messes up my data when that happens. Thank you in advance. |
All times are GMT +1. The time now is 07:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com