Bulk export using BCP on Azure

518 Views Asked by At

Within sql server, in a scheduled job, I was using the below command to create a csv file and upload it in a directory.

EXEC('EXEC xp_cmdshell ''bcp dbo.sales out "f:\db\salesbackUp\29July2022.csv" -T -c -t"," -C ACP -r\n -S"ICT-SQL02\ICTEPIC"''');

Now, I migrated to azure database ... Is there any solution which will help me run the similar command, so that I can upload the csv file the either to azure storage or any where directly within the sql command. So that I can create the same scheduled job in azure job database.

1

There are 1 best solutions below

2
Utkarsh Pal On

There are multiple approach to execute this but the best you can do by using Azure Data Factory.

Azure Data Factory is a fully managed, serverless data integration service.

There are two methods:

  1. Using copy activity you can move the data from Azure SQL database to Blob storage. Refer Tutorial: Copy data from a SQL Server database to Azure Blob storage

  2. You can copy multiple tables in bulk using Powershell in Azure Data Factory. Refer Copy multiple tables in bulk by using Azure Data Factory using PowerShell