BCP Utility Help

  • Does any one know if it's possible to use the BCP utility to output a file with a LINE FEED character as the row terminator?

    Currently I'm executing the following stmts

    @bcpStmt = bcp "SELECT EMPLOYEE_NAME + UNION_CODE FROM DBName.dbo.vw_Test" queryout "\\TestDir\Exports\TestFile.txt" -c -r \r -Sservername -Uusername -Ppassword

    EXECUTE master..xp_cmdshell @bcpStmt, no_output

    It works fine but the -r \r switch is outputting the carriage return (OD in hex).  I need it to output a line feed (0A in hex).  Is this possible???

    Thanks for any help.

  • Ah, I just found the solution....  in case anyone else needs this...

     

    http://www.sqlteam.com/FORUMS/topic.asp?TOPIC_ID=65369

    You can specify the field terminator with the -c paramater and the row terminator with the -r switch. Sometimes the row terminator for a file from a UNIX system is a line feed, instead of the Windows default of Carriage Return+Line Feed. If that is the case you can specify the row terminator in hex fomat: -r 0x0A

    Thanks Michael Valentine Jones 

     

  • Or you can use Format File.

    _____________
    Code for TallyGenerator

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply