I'm using sqlcmd to export a query result with two columns to csv. The simple query is:
SELECT DISTINCT
CustomerGuid, CustomerPassword
FROM
ServiceOrder
ORDER BY
CustomerGuid
When I open the exported csv in Excel both customer and password are on the same column. Is it possible to split them into their own column using sqlcmd. My sqlcmd looks like
SQLCMD -S . -d BAS -Q "SQL STATEMENT" -s "," -o "c:\data.csv"
Thanks.
The problem is that you are using ,
instead of ;
as the line delimiter. Try:
SQLCMD -S . -d BAS -Q "SQL STATEMENT" -s ";" -o "c:\data.csv"
:)