Greetings!!!
I am using the Powershell code below to connect to an Azure SQL Database and would like to export data as json document on to Azure Datalake Gen2. Could you please guide me how to accomplish this.
$InstanceName = "SQLTEST\DEMO"
$connectionString = "Server=$InstanceName;Database=sqldb;Integrated Security=True;"
$query = "SELECT * FROM dbo.Inventory"
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()
$command = $connection.CreateCommand()
$command.CommandText = $query
$result = $command.ExecuteReader()
$table = new-object "System.Data.DataTable"
$table.Load($result)
$table | select $table.Columns.ColumnName | ConvertTo-Json
$connection.Close()
Thank you