question

Jim Czerniak avatar image
Jim Czerniak asked

Export Table Data Using a Query

I want to use a query to export the data from a table into a tab-delimeted text file. I've tried the following...

EXEC master..xp_cmdshell 'osql -S localhost -U sa -P support -q "select * from ims_enhanced..ims_inventory" -o c:\inventory.txt'

But this just appears to save the query result set off to a text file that is not delimeted at all.

Essentially, I need to know if there is a way to perform an export of a table(s) using a query instead of the DTS wizard.

Thank you in advance for your help,

Jim Czerniak Systems Engineer

sql-server-2000querydtsexport-data
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Kristen avatar image
Kristen answered

You should be able to do pretty much as you have, using OSQL, but use BCP instead. BCP is gear to exporting (and importing) data.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.