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!

How to dump SQL Table into csv or txt 1

Status
Not open for further replies.

amardesai2005

Programmer
Sep 1, 2005
14
US
How do i dump sql Table into csv or txt ?

Anyone can please help me out to write sql which dump sql table data into csv.

I have table name called productnames
Thanks
AD
 
When i try to run this in query analyzer. I am getting syntax error.

bcp productnames out "c:\files.txt" -S {NS_EDB_D3} -T -t "," -c


could you please look at following topic which i have posted.

Improve perfomance-Transfer data one table to another

Please help me out.

AD
 
did you do the bcp from a command window or from query analyzer? what was the syntax error? Also I believe you do not nee the {} for the server name

Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
You could run it from QA like this (assuming you can execute xp_cmdshell )

This will work for the publisher table in the Pubs DB

exec master..xp_cmdshell 'bcp pubs.dbo.publishers out "c:\files.txt" -S {YourServerNameHere} -T -t "," -c'



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top