How to use TAB as column separator in SQLCMD

后端 未结 11 1240
后悔当初
后悔当初 2020-12-16 17:36

SQLCMD supports the -s parameter to specify the column separator, but I couldn\'t figure how how to represent the tab (CHAR(9)) character. I have tried the following but bo

11条回答
  •  無奈伤痛
    2020-12-16 18:29

    To work in the Command Prompt window instead in batch file, this is the only way that I have found to solve it:

    sqlcmd -S ServerName -E -d database_Name -Q"select col1, char(9), col2, char(9), col3, char(9), col4, char(9), col5 from mytable" -o results.txt -W -w 1024 -s "" -m 1

提交回复
热议问题