I already got the csv file with data but i need data with columns I have many table which i need to execute at one go and save data in csv format at one location with header i don't want to add columns name as their 100 table. I am using below query
Declare @cmd varchar(8000)
Set @cmd='Bcp"select * from tablename where condition queryout "path" -s -T -f -t, -c -E
EXECUTE master..xp_cmdshell
Their 100 tables like that.. any suggestion