How do I pass non-printable characters to BCP's field/row terminator parameters?

I have a tab delimited file I am trying to import into SQL Server 2012; the row terminator is CRLF. The following is my BCP statement in PowerShell:

bcp database.dbo.table IN C:\filePath.tsv -SserverName -UuserName -Ppassword -c -t\t -r\n

Which reports a

Unexpected EOF encountered

error.

I can't for the life of me figure out why this is not working. An extra eye would be great.

EDIT: After review, I think the problem is with -r\n...What is the metacharacter for CRLF?

Answers


Encode it in hex:

bcp database.dbo.table IN C:\filePath.tsv -SserverName -UuserName -Ppassword -c -t0x9 -r0xa

You can use multiple characters by encoding each in hex and appending them together. For example, we use the record separator character, carriage return, and newline to separate each row, so we pass 0x1e0d0a as the value of the -r parameter.

I use ASCII Table to do quick lookups for this.


Need Your Help

how to change url with textbox value

php mysql html5

I have a site, e.g., http://www.example.com/

Laravel user forms and admin forms: how to tackle?

forms laravel controller laravel-4

Just a question to poll how you guys would tackle this in Laravel: