Exporting from Access?
I am expor开发者_如何学运维ting a table from Microsoft Access 2000 to a CSV format file. Most of the data comes out OK but a field which is all numbers is exported as a numeric field - which I do not want. How can I retain the text format of the table field where the data is a fixed 6 character field eg. 001234 ?
If you always want the number to of fixed number of 0, and text, build a query, and export that.
For the number column, just use:
format([Column],"000000")
So, the number 5 would be output as 000005. You could also put a cstr() function around the above, but I do not think you need. You can type the above expression direct in the sql view, or in the query grid, you could/would go:
MyCustNum: (format([Column],"00000"))
So, the column name MyCustNum will be different then the actual column name used in this export. So, simply export the query in place of the table. This also allows you to set order of the output data if need be.
精彩评论