Write to Azure VM from Azure SQL database

azure-sql-database azure-virtual-machine

44 просмотра

1 ответ

I have an Azure SQL database which has a stored procedures that outputs data in CSV format that I would like to write to a folder on an Azure VM.

Can anyone recommend how I might be able to do it?

Автор: mike Источник Размещён: 08.11.2019 11:28

Ответы (1)


0 плюса

You've got a few options to get data out of sql and into a CSV:

Powershell

It's free, built in to every Windows Azure VM, and pretty easy to use. The two commandlets you're going to want to use are Invoke-Sqlcmd and Export-CSV.

I found a quick example here.

SSIS

If your Azure VM is running a SQL instance, you could create a quick SSIS package that calls the procedure and dumps the output into a CSV.

sqlcmd

Again, if your Azure VM has SQL on it you could call sqlcmd.exe to spit out your CSV file.

sqlcmd -S MyServer.database.windows.net 
       -d yourdatabase -E -Q "EXEC usp_yourProcedure" 
       -o "MyData.csv" -h-1 -s"," -w 4000

Choose the one that best fits your limitations. If you're not running SQL on that VM, Powershell, or some custom programming will be needed.

Автор: Shannon Lowder Размещён: 31.08.2016 12:46
Вопросы из категории :
32x32