How to use TAB as column separator in SQLCMD

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

    Found a good answer here: SQLCMD outfile as tab delimited text file

    1. Open Notepad
    2. Paste this: sqlcmd -S (local) -E -s"" -Q "select * from sys.dm_exec_query_stats" -o MyOutput.txt -h-1 -W
    3. Highlight , then hit the Tab key
    4. Save the file as MyBatch.bat
    5. Run MyBatch.bat

提交回复
热议问题