How to prevent system from adding carriage return character to SQL query output?

SQLCMD probably not the right tool for exporting data. You can use -w to increase column width, but it has a maximum value of 65535 (given your description you are probably already doing this). -y 0 is an alternative, but that will space pad everything massively, and it still has a limit (1 MB I think?)

We built a little program in VBasic, or similar, to handle raw output to some sort of delimited file, but SSIS or similar might be a better route to go down.

I presume you are sure that pipeline characters do not exist anywhere in the data? We get people on our website registering as ||||||||@something.com presumably thinking it will stop us trying to flog their email address to other companies ...

1 Like