简体   繁体   中英

Specify rowterminator when creating a file with SQLCMD

How do you specify the the row terminator when outputting query results using sqlcmd?

bcp is not an option.

sqlcmd -E -s"   " -Q "Select * From SomeTable" -o C:\Output.txt  -W

What is the default row terminator?

You can only choose column separator with -s. There is not option to specify row terminator.

So it is CR + LF because the output goes to command line. However, data may be truncated so you have to control the output width.

See sqlcmd for -s, -w, -W, -y, -Y etc

bcp may not be an option, as you say, but neither is row terminator in sqlcmd...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM