How can I export data from a table to a CSV file? I am working with an
Account package with multiple companies. Each company has its own database
and all the tables are named the same thing. I want to export all the data i
n
a table called Account for each company to a CSV file. There are about 20
companies and I do not want to manually do this using DTS. Is there a way I
could write a script to do this?
Thanks
EmmaIf you do not want to use DTS, you can use BCP. It is a command line
directive that allows you to export to a file directly from a table, view or
a query.
Rather than me explaining more about it, you can check look the BCP usage in
SQL Server Books Online.
Let me know if it helps.
"Emma" wrote:
> How can I export data from a table to a CSV file? I am working with an
> Account package with multiple companies. Each company has its own database
> and all the tables are named the same thing. I want to export all the data
in
> a table called Account for each company to a CSV file. There are about 20
> companies and I do not want to manually do this using DTS. Is there a way
I
> could write a script to do this?
> Thanks
> Emma
>|||Huge ask for a simple manual task.
one question, hope its a one time request. If so the time scripting can get
you around 100 tables to CSV using DTS.
Again in my mind i was going wild like, using osql put it in batchfile and
input account name to script it to csv. Again for such things you need to
provide accountname hardcoded.
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Emma" wrote:
> How can I export data from a table to a CSV file? I am working with an
> Account package with multiple companies. Each company has its own database
> and all the tables are named the same thing. I want to export all the data
in
> a table called Account for each company to a CSV file. There are about 20
> companies and I do not want to manually do this using DTS. Is there a way
I
> could write a script to do this?
> Thanks
> Emma
>|||Thanks Edgardo. BCP did the job.
Emma
"Edgardo Valdez, MCSD, MCDBA" wrote:
> If you do not want to use DTS, you can use BCP. It is a command line
> directive that allows you to export to a file directly from a table, view
or
> a query.
> Rather than me explaining more about it, you can check look the BCP usage
in
> SQL Server Books Online.
> Let me know if it helps.
> "Emma" wrote:
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment