exec xp_cmdshell bcp syntax
问题 I can't seem to find the right syntax to export data with column names using exec xp_cmdshell bcp in sql server management studio.I've tried the below variations EXEC xp_cmdshell bcp "select "a_id","b_id","c_id" union select a_id,b_id,c_id from tablename out "\\network_path\a.txt" -c -Uusername -Ppassword -Sservername" And EXEC xp_cmdshell bcp 'select 'a_id','b_id','c_id' union select a_id,b_id,c_id from tablename out '\\network_path\a.txt' -c -Uusername -Ppassword -Sservername' And EXEC xp