I am currently trying to BCP out of a Sybase ASE database (15.7) into BCP into SQL Server (2016). All BCP tasks are being run on Windows environments.
As I have records with CRLF characters, I have needed to specify a custom record terminator to overcome this issue. The terminator I would have liked to use is "~\t\t\t\t\t~\r\n". I have added the CRLF characters for readability in case I need to open the files. The Out command is as follows:
bcp database..table out table.dat -Sserver -Uuser -Ppassword -c -t "|\t\t\t\t\t|" -r "~\t\t\t\t\t~\r\n"
When I BCP back in to SQL Server, I am getting a "String data, right truncation error". The command is as follows:
bcp database..table in table.dat -SServer -T -c -t "|\t\t\t\t\t|" -r "~\t\t\t\t\t~r\n"
I am using the ASE 15.7 SP126 version of BCP for out. I am using the SQL Server 2016 version of BCP (13.0.1601.5) for in.
Based on the thread here, I have determined that the issue is with the \r\n characters used for the -r option. If I test just using a -r "\r\n" on the out and a -r "0x0a" on the in, it works (apart from failing on the records where I have CRLF's in the data).
As soon as I remove the \r\n characters on the out and the in, I can BCP in the data successfully.
Does anyone know if is any way I can used a combination of printable characters + a CRLF?
Cheers.