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.
There are multiple approach to execute this but the best you can do by using Azure Data Factory.
There are two methods:
Using
copy activityyou can move the data from Azure SQL database to Blob storage. Refer Tutorial: Copy data from a SQL Server database to Azure Blob storageYou 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