Question: I need to add headings to my SQL columns which is generated by a batch file. However by default I get -------- in the second

I need to add headings to my SQL columns which is generated by a batch file. However by default I get "--------" in the second row below each column header, which I do NOT want.

Batch:

sqlcmd.exe /U admin /P xxxxx /d database /S sql1 /i APCheckInterfaceQuery.sql /W /o "F:\IT\Applications\Export\APCheckInterface_output_file.txt" /s ","

What do I add to my batch file to get the column headings without the dashes in the second row?

I also tried to modify the SQL directly to manually add column headers (and use /h -1 in the batch to take the headers out), but I get conversion errors. Because some columns are numeric and the headers would be varchar:

Select 'Check#' as Check# , 'CheckDate' as CheckDate , 'VendNbr' as VendNbr , 'VendName' as VendName , 'CheckAmt' as CheckAmt , 'Session#' as Session#

....etc.

I'll get the following error: Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to numeric.

Please help me. Thank you.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!