Skip to content

Instantly share code, notes, and snippets.

@dkapitan
Created April 24, 2015 09:55
Show Gist options
  • Save dkapitan/14fdc088a39d07b538ca to your computer and use it in GitHub Desktop.
Save dkapitan/14fdc088a39d07b538ca to your computer and use it in GitHub Desktop.
template T-SQL stored procedure export to .csv
-- let op: system accounts medinova\shannon_mssql en medinova\Shannon_SQLAgent moeten toegang hebben tot de directory waar naar toe wordt geschreven
declare @sql varchar(8000)
select @sql = 'bcp "select * from clinics01.dbo.DIM_DAG" queryout D:\etl\exports\valuecare\conversie\test.csv -c -t, -T -S' + @@servername
exec master..xp_cmdshell @sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment