Database Name : TESTING
Table Name : TEST
Client_Code Client_Name Amount
123 ABC 10
456 PQR 20
789 XYZ 30
147 IJK 40
Required Output in CSV with Fallowing Header
Client Code Client Name Total balance
123 ABC 10
456 PQR 20
789 XYZ 30
147 IJK 40
I am using fallowing Query, But Result I am getting without Header
exec master..xp_cmdshell 'bcp "select * from TESTING.dbo.TEST" queryout C:\queryoutput.csv -t"," -S"NEMP-HNI6101\SQLEXPRESS" -T -c -C RAW'
How to Export to csv using above command with header like Client Code
, Client Name
and Total balance
?
Kindly suggest sql Query