Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a script file to export data from a table to a text file

Status
Not open for further replies.

shanghai2004

Programmer
Dec 16, 2004
37
CA
Hi,
Is it possible to create a script file to export data from a table to a text file? (T-SQL or VB script)
I know we can use DTS package to do this, but I have many tables(in different structures)need to export data from. If I can have a script file to do this (with two parameters: table name and text file name), I can build a top loop to assign values to the two parameters.
Any suggestions? Help please.

Thanks
 
Yes you can. Use BCP. It's a commandline tool that you can pass the table name and file name and it will export all the data. It will not include headers however.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top