BCP out .csv with Pipe problem

Posted on 2008-11-09
Last Modified: 2012-05-05
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.


Open in new window

Question by:Lawrence Barnes
    LVL 15

    Accepted Solution

    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
    LVL 5

    Author Closing Comment

    by:Lawrence Barnes
    Thank you

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now