Sunday, February 19, 2012

Export to CSV with field headers

I need to export multiple tables to a csv file with field headers. BCP will not bring across the field headers and I need to do this on a daily basis.
Any suggestions?
John
You could do it using DTS.
"John" <anonymous@.discussions.microsoft.com> schreef in bericht
news:6EF27F05-C2CB-4339-ADF6-804924A47466@.microsoft.com...
> I need to export multiple tables to a csv file with field headers. BCP
will not bring across the field headers and I need to do this on a daily
basis.
> Any suggestions?
> John
|||Hi,
You can create a DTS package with SQL server as source and Excel file as
target. After saving the package you can schedule it to run daily based on
your requirement.
How to create the package:
1. In Enterprise manager
2. Data Transformation option
3. Local packages
4. Right click and create new package
5. Create one connection for sql server and dest connection for excel and
create a transformation task
6. Save this as a package and schedule it using SQL Agent.
Thanks
Hari
MCDBA
"John" <anonymous@.discussions.microsoft.com> wrote in message
news:6EF27F05-C2CB-4339-ADF6-804924A47466@.microsoft.com...
> I need to export multiple tables to a csv file with field headers. BCP
will not bring across the field headers and I need to do this on a daily
basis.
> Any suggestions?
> John
|||Thanks for the answer - I wanted to go to a csv test file to avoid some of the limitations of Excel - 65K records and stick to a neutral format like csv.
|||Hi John
In that case instead of Excel as destination select the destination as Text
file and in the file name give file_name.CSV. By default the file will be
comma seperated.
Thanks
Hari
MCDBA
"John" <anonymous@.discussions.microsoft.com> wrote in message
news:2ABACAEE-F714-40B7-A8EA-D462856A21E0@.microsoft.com...
> Thanks for the answer - I wanted to go to a csv test file to avoid some of
the limitations of Excel - 65K records and stick to a neutral format like
csv.

No comments:

Post a Comment