You can run xp_cmdshell
to start the bcp
operation:
use [master]; declare @sql nvarchar(4000) select @sql = 'bcp "select * from sys.columns" queryout c:\file.csv -c -t, -T -S'+ @@servername exec xp_cmdshell @sql
Of course, you would have to figure out how to format your qualifiers (perhaps via a format file)
EDIT:
Your original request should be something like strings:
SELECT IntValue + '"' + CharValue + '"' FROM TABLE
You may also need to enable this feature.
EXEC sp_configure 'show advanced options', 1; RECONFIGURE; GO EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; GO
source share