用于清除SQL表的Azure数据存储管道
我想知道我是否可以创建一个Azure管道并让它运行一个清除我的Azure SQL表的过程 我对数据工厂的概念还很陌生,我发现数据工厂通常都有管道可以将数据从blob复制到azure SQL/本地SQL或其他方式用于清除SQL表的Azure数据存储管道,azure,azure-sql-database,pipeline,azure-data-factory,purge,Azure,Azure Sql Database,Pipeline,Azure Data Factory,Purge,我想知道我是否可以创建一个Azure管道并让它运行一个清除我的Azure SQL表的过程 我对数据工厂的概念还很陌生,我发现数据工厂通常都有管道可以将数据从blob复制到azure SQL/本地SQL或其他方式 我正在尝试编写一个数据工厂管道,它将清除我的Azure SQL DB中的旧记录,并希望有人能为我指明正确的方向。我仍然可以为此使用Azure数据工厂吗 我的建议是使用Azure Automation而不是ADF来调度存储过程的执行。您将找到示例和示例。以下是您需要在Azure Autom
我正在尝试编写一个数据工厂管道,它将清除我的Azure SQL DB中的旧记录,并希望有人能为我指明正确的方向。我仍然可以为此使用Azure数据工厂吗 我的建议是使用Azure Automation而不是ADF来调度存储过程的执行。您将找到示例和示例。以下是您需要在Azure Automation上实现的代码:
workflow NAME-OF-YOUR-WORKFLOW
{
Write-Output "JOB START BEFORE INLINESCRIPT"
inlinescript
{
Write-Output "JOB START"
# Create connection to Master DB
$MasterDatabaseConnection = New-Object System.Data.SqlClient.SqlConnection
$MasterDatabaseConnection.ConnectionString = "Data Source=YOUR-DATABASE-SERVER-NAME.database.windows.net;Initial Catalog=YOUR-DATABASE-NAME;Integrated Security=False;User ID=YOUR-DATABASE-USERNAME;Password=YOUR-DATABASE-PASSWORD;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False"
$MasterDatabaseConnection.Open()
Write-Output "CONNECTION OPEN"
# Create command
$MasterDatabaseCommand = New-Object System.Data.SqlClient.SqlCommand
$MasterDatabaseCommand.Connection = $MasterDatabaseConnection
$MasterDatabaseCommand.CommandText = "YOUR-PROCEDURE-NAME"
Write-Output "DATABASE COMMAND TEXT ASSIGNED"
# Execute the query
$MasterDatabaseCommand.ExecuteNonQuery()
Write-Output "EXECUTING QUERY"
# Close connection to Master DB
$MasterDatabaseConnection.Close()
Write-Output "CONNECTION CLOSED"
}
Write-Output "WORK END - AFTER INLINESCRIPT"
}
要了解有关Azure自动化的更多信息,请单击
希望这有帮助。我的建议是使用Azure Automation而不是ADF来计划存储过程的执行。您将找到示例和示例。以下是您需要在Azure Automation上实现的代码:
workflow NAME-OF-YOUR-WORKFLOW
{
Write-Output "JOB START BEFORE INLINESCRIPT"
inlinescript
{
Write-Output "JOB START"
# Create connection to Master DB
$MasterDatabaseConnection = New-Object System.Data.SqlClient.SqlConnection
$MasterDatabaseConnection.ConnectionString = "Data Source=YOUR-DATABASE-SERVER-NAME.database.windows.net;Initial Catalog=YOUR-DATABASE-NAME;Integrated Security=False;User ID=YOUR-DATABASE-USERNAME;Password=YOUR-DATABASE-PASSWORD;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False"
$MasterDatabaseConnection.Open()
Write-Output "CONNECTION OPEN"
# Create command
$MasterDatabaseCommand = New-Object System.Data.SqlClient.SqlCommand
$MasterDatabaseCommand.Connection = $MasterDatabaseConnection
$MasterDatabaseCommand.CommandText = "YOUR-PROCEDURE-NAME"
Write-Output "DATABASE COMMAND TEXT ASSIGNED"
# Execute the query
$MasterDatabaseCommand.ExecuteNonQuery()
Write-Output "EXECUTING QUERY"
# Close connection to Master DB
$MasterDatabaseConnection.Close()
Write-Output "CONNECTION CLOSED"
}
Write-Output "WORK END - AFTER INLINESCRIPT"
}
要了解有关Azure自动化的更多信息,请单击
希望这有帮助