Nov-19-2022, 05:16 PM
Hi Team,
I found below code on google, while searching for BCP Export with header.
-h-1 ------ this removes header as per their explanation, But I want to keep it into output file.
Also is this possible run query using Subprocess module or BCP Module
I found below code on google, while searching for BCP Export with header.
-h-1 ------ this removes header as per their explanation, But I want to keep it into output file.
Also is this possible run query using Subprocess module or BCP Module
sqlcmd -S MyServer -d myDB -E -Q "select col1, col2, col3 from SomeTable" -o "MyData.csv" -h-1 -s"," -w 700 -h-1 removes column name headers from the result -s"," sets the column seperator to , -w 700 sets the row width to 700 chars (this will need to be as wide as the longest row or it will wrap to the next line)