Hello @V
To achieve your goal of writing to two tables using a stored procedure, you can use a pipeline with a Stored Procedure Activity. Here are the high-level steps you can follow:
1.Use a Lookup Activity to get data from the first table using a stored procedure.
- Use a Copy Activity to copy data from the second table to a staging table in your destination database.
- Use a Stored Procedure Activity to compare the data from the Lookup Activity with the data in the staging table and write to both tables using a stored procedure.
Here's an example of how you can define the Stored Procedure Activity in your pipeline:
{
"name": "WriteToTwoTables",
"type": "SqlServerStoredProcedure",
"linkedServiceName": "",
"typeProperties": {
"storedProcedureName": "",
"storedProcedureParameters": {
"inputTable": {
"value": "@activity('LookupActivity').output",
"type": "Table"
},
"outputTable1": {
"value": "",
"type": "String"
},
"outputTable2": {
"value": "",
"type": "String"
}
}
},
"dependsOn": [
{
"activity": "LookupActivity",
"dependencyConditions": [
"Succeeded"
]
},
{
"activity": "CopyActivity",
"dependencyConditions": [
"Succeeded"
]
}
]
}
In the Stored Procedure Activity, you can pass the output of the Lookup Activity as a parameter to your stored procedure. You can also pass the names of your two output tables as parameters to the stored procedure. I hope this helps! Let me know if you have any further questions.