How to use TAB as column separator in SQLCMD

后端 未结 11 1242
后悔当初
后悔当初 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:27

    To achieve this using sqlcmd you need to use the Tab character like so: \t An example query exporting a single sql database table into a text file using a tab delimiter is as follows:

    sqlcmd -S ServerName -d databaseTableName -Q "SELECT * FROM TABLE_NAME" -o C:\backups\tab_delimiter_bakup.txt -s"\t"
    

提交回复
热议问题