Bulk Insert using BCP

  • Hello everyone,

    I hve been using BCP for bulk loading successfully before I encountered this issue on one of our server.

    I was able to create a format file with any row or field terminator using following statement

    bcp SSCommerceServer.dbo.shop_receipt format nul -n -f c:\BCPFF1\dummy.fmt -T

    when the same statement is used with row and field delimeter im getting error stating the -r is neither internal or external command.

    bcp SSCommerceServer.dbo.shop_receipt format nul -n -f c:\dts_store\BCPFF1\dummy.fmt -t || -r\p -T

    or

    bcp SSCommerceServer.dbo.shop_receipt format nul -n -f c:\dts_store\BCPFF1\dummy.fmt -t || -r\p -U XXX -P pppp (use -U to provide username or use -T for trusted connection)

    Above two t-sql executes fine on other servers.

    ps: replace n for p in row terminator specification. Browser doesnt seems to print them 🙂

    Any suggestion will be helpful

    Ta

  • The pipe character you are using as a terminator is also a batch script operator - you are effectively piping the result of the command to the statement after the pipe - hence the error.

    Enclose the terminator characters in double quotes.

    Paul

  • Hi Paul,

    Thats exactly where the problem was!!

    Thank you

  • Awesome 🙂

  • Hi Paul ,

    A great thank you because this was exactly the same problem with my other post http://www.sqlservercentral.com/Forums/Topic741031-145-1.aspx were I was using PIPE as delimiter. Accidently it was you who helped me again. I didnt had any clue becoz it successfully inserted first 20000 + rows. But after your reply I did change to other delimiter on that BULK insert and it started to load all the rows.

    Thank you for your spot on ...

    Ta

Viewing 5 posts - 1 through 4 (of 4 total)

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