I am using BCP command to exporting result set to .csv file. Here is the code,
declare @SQLcommand nvarchar(4000)
set @SQLcommand = 'bcp DATABASENAME.dbo.UBCommitteeReport out filename.csv -T -c -t, -S SERVERNAME'
exec xp_cmdshell @SQLcommand
Is there any way to copy the column name/header name into the .csv file using the bcp? If not, what are the other alternatives?
Any help would be greatly appreciated.