Sqlcmd to generate file without dashed line under header, without row count

后端 未结 8 1927
难免孤独
难免孤独 2021-02-01 06:09

Using the following sqlcmd script:

sqlcmd -S . -d MyDb -E -s, -W -Q \"select account,rptmonth, thename from theTable\"  
> c:\\dataExport.csv
<
8条回答
  •  情书的邮戳
    2021-02-01 06:49

    1.Create the file first with the header columns

    2.Apprend the sqlcmd output to the file using the option -h-1

    echo acctnum,rptmonth,facilname > c:\dataExport.csv sqlcmd -S . -d MyDb -E -s, -h-1 -W -Q "select account,rptmonth, thename from theTable" >> c:\dataExport.csv

提交回复
热议问题