BCP out .csv with Pipe problem

Lawrence Barnes
Lawrence Barnes used Ask the Experts™
on
I need to bcp out a pipe delimimted .csv file.  The following is giving me a command line error. What's wrong with it?



declare @sql varchar(8000)
select @sql = 'bcp Test..Property1 out c:\Temp\property1.txt -c -t| -T -S' + @@servername
exec Test..xp_cmdshell @sql
 
Here's the output error:
'-T' is not recognized as an internal or external command,
operable program or batch file.
NULL

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try the following..

declare @sql varchar(8000)
select @sql = 'bcp pubs..authors out c:\Temp\property1.txt -c -t"|" -T -S' + @@servername
 
exec master..xp_cmdshell @sql
 

Author

Commented:
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial