Azure Functions の Azure SQL 出力バインド (プレビュー)
Azure SQL 出力バインドでは、データベースに書き込みできます。
セットアップと構成の詳細については、概要に関するページをご覧ください。
例
C# 関数は、次の C# モードのいずれかを使用して作成できます。
- インプロセス クラス ライブラリ: Functions ランタイムと同じプロセスで実行されるコンパイル済みの C# 関数。
- 分離ワーカー プロセス クラス ライブラリ: ランタイムから分離されたワーカー プロセスで実行されるコンパイル済みの C# 関数。 分離ワーカー プロセスは、非 LTS バージョンの .NET および.NET Framework で実行されている C# 関数をサポートするために必要です。
- C# スクリプト: Azure portal で c# 関数を作成するときに主に使用されます。
Azure SQL 出力バインドのその他のサンプルは、GitHub リポジトリで入手できます。
このセクションには、次の例が含まれています。
次の例では ToDoItem
クラスとそれに対応するデータベース テーブルを参照します。
namespace AzureSQL.ToDo
{
public class ToDoItem
{
public Guid Id { get; set; }
public int? order { get; set; }
public string title { get; set; }
public string url { get; set; }
public bool? completed { get; set; }
}
}
CREATE TABLE dbo.ToDo (
[Id] UNIQUEIDENTIFIER PRIMARY KEY,
[order] INT NULL,
[title] NVARCHAR(200) NOT NULL,
[url] NVARCHAR(200) NOT NULL,
[completed] BIT NOT NULL
);
HTTP トリガー、1 つのレコードを書き込む
次の例では、C# 関数 で、JSON 本文として HTTP POST 要求に含まれるデータを利用し、レコードがデータベースに追加されます。
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace AzureSQL.ToDo
{
public static class PostToDo
{
// create a new ToDoItem from body object
// uses output binding to insert new item into ToDo table
[FunctionName("PostToDo")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "PostFunction")] HttpRequest req,
ILogger log,
[Sql("dbo.ToDo", ConnectionStringSetting = "SqlConnectionString")] IAsyncCollector<ToDoItem> toDoItems)
{
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
ToDoItem toDoItem = JsonConvert.DeserializeObject<ToDoItem>(requestBody);
// generate a new id for the todo item
toDoItem.Id = Guid.NewGuid();
// set Url from env variable ToDoUri
toDoItem.url = Environment.GetEnvironmentVariable("ToDoUri")+"?id="+toDoItem.Id.ToString();
// if completed is not provided, default to false
if (toDoItem.completed == null)
{
toDoItem.completed = false;
}
await toDoItems.AddAsync(toDoItem);
await toDoItems.FlushAsync();
List<ToDoItem> toDoItemList = new List<ToDoItem> { toDoItem };
return new OkObjectResult(toDoItemList);
}
}
}
HTTP トリガー、2 つのテーブルに書き込む
次の例では、C# 関数 で、JSON 本文および複数の出力バインドとして HTTP POST 要求に含まれるデータを利用し、異なる 2 つのテーブル (dbo.ToDo
と dbo.RequestLog
) でレコードがデータベースに追加されます。
CREATE TABLE dbo.RequestLog (
Id int identity(1,1) primary key,
RequestTimeStamp datetime2 not null,
ItemCount int not null
)
namespace AzureSQL.ToDo
{
public static class PostToDo
{
// create a new ToDoItem from body object
// uses output binding to insert new item into ToDo table
[FunctionName("PostToDo")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "PostFunction")] HttpRequest req,
ILogger log,
[Sql("dbo.ToDo", ConnectionStringSetting = "SqlConnectionString")] IAsyncCollector<ToDoItem> toDoItems,
[Sql("dbo.RequestLog", ConnectionStringSetting = "SqlConnectionString")] IAsyncCollector<RequestLog> requestLogs)
{
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
ToDoItem toDoItem = JsonConvert.DeserializeObject<ToDoItem>(requestBody);
// generate a new id for the todo item
toDoItem.Id = Guid.NewGuid();
// set Url from env variable ToDoUri
toDoItem.url = Environment.GetEnvironmentVariable("ToDoUri")+"?id="+toDoItem.Id.ToString();
// if completed is not provided, default to false
if (toDoItem.completed == null)
{
toDoItem.completed = false;
}
await toDoItems.AddAsync(toDoItem);
await toDoItems.FlushAsync();
List<ToDoItem> toDoItemList = new List<ToDoItem> { toDoItem };
requestLog = new RequestLog();
requestLog.RequestTimeStamp = DateTime.Now;
requestLog.ItemCount = 1;
await requestLogs.AddAsync(requestLog);
await requestLogs.FlushAsync();
return new OkObjectResult(toDoItemList);
}
}
public class RequestLog {
public DateTime RequestTimeStamp { get; set; }
public int ItemCount { get; set; }
}
}
HTTP トリガー、IAsyncCollector を使用してレコードを書き込む
次の例では、C# 関数 で、HTTP POST 本文の JSON 配列に含まれるデータを利用し、レコード コレクションがデータベースに追加されます。
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Newtonsoft.Json;
using System.IO;
using System.Threading.Tasks;
namespace AzureSQLSamples
{
public static class WriteRecordsAsync
{
[FunctionName("WriteRecordsAsync")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "addtodo-asynccollector")]
HttpRequest req,
[Sql("dbo.ToDo", ConnectionStringSetting = "SqlConnectionString")] IAsyncCollector<ToDoItem> newItems)
{
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var incomingItems = JsonConvert.DeserializeObject<ToDoItem[]>(requestBody);
foreach (ToDoItem newItem in incomingItems)
{
await newItems.AddAsync(newItem);
}
// Rows are upserted here
await newItems.FlushAsync();
return new CreatedResult($"/api/addtodo-asynccollector", "done");
}
}
}
Azure SQL 出力バインドのその他のサンプルは、GitHub リポジトリで入手できます。
このセクションには、次の例が含まれています。
次の例では ToDoItem
クラス (別個のファイル ToDoItem.java
内) とそれに対応するデータベース テーブルを参照します。
package com.function;
import java.util.UUID;
public class ToDoItem {
public UUID Id;
public int order;
public String title;
public String url;
public boolean completed;
public ToDoItem() {
}
public ToDoItem(UUID Id, int order, String title, String url, boolean completed) {
this.Id = Id;
this.order = order;
this.title = title;
this.url = url;
this.completed = completed;
}
}
CREATE TABLE dbo.ToDo (
[Id] UNIQUEIDENTIFIER PRIMARY KEY,
[order] INT NULL,
[title] NVARCHAR(200) NOT NULL,
[url] NVARCHAR(200) NOT NULL,
[completed] BIT NOT NULL
);
HTTP トリガー、レコードをテーブルに書き込む
次の例は、JSON 本文として HTTP POST 要求に含まれるデータを利用して、レコードをテーブルに追加する Java 関数の SQL 出力バインドを示します。 この関数では、JSON 本文を解析するために com.fasterxml.jackson.core ライブラリに対する追加の依存関係を受け取ります。
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.1</version>
</dependency>
package com.function;
import java.util.*;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.sql.annotation.SQLOutput;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Optional;
public class PostToDo {
@FunctionName("PostToDo")
public HttpResponseMessage run(
@HttpTrigger(name = "req", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
@SQLOutput(
name = "toDoItem",
commandText = "dbo.ToDo",
connectionStringSetting = "SqlConnectionString")
OutputBinding<ToDoItem> output) throws JsonParseException, JsonMappingException, JsonProcessingException {
String json = request.getBody().get();
ObjectMapper mapper = new ObjectMapper();
ToDoItem newToDo = mapper.readValue(json, ToDoItem.class);
newToDo.Id = UUID.randomUUID();
output.setValue(newToDo);
return request.createResponseBuilder(HttpStatus.CREATED).header("Content-Type", "application/json").body(output).build();
}
}
HTTP トリガー、2 つのテーブルに書き込む
次の例では、HTTP POST 要求で JSON 本文として提供されるデータと、複数の出力バインドを使って、データベースの 2 つの異なるテーブル (dbo.ToDo
と dbo.RequestLog
) にレコードを追加する JavaS 関数内の SQL 出力バインドを示します。 この関数では、JSON 本文を解析するために com.fasterxml.jackson.core ライブラリに対する追加の依存関係を受け取ります。
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.1</version>
</dependency>
2 番目のテーブル dbo.RequestLog
は、次の定義に対応します。
CREATE TABLE dbo.RequestLog (
Id INT IDENTITY(1,1) PRIMARY KEY,
RequestTimeStamp DATETIME2 NOT NULL DEFAULT(GETDATE()),
ItemCount INT NOT NULL
)
および RequestLog.java
の Java クラス:
package com.function;
import java.util.Date;
public class RequestLog {
public int Id;
public Date RequestTimeStamp;
public int ItemCount;
public RequestLog() {
}
public RequestLog(int Id, Date RequestTimeStamp, int ItemCount) {
this.Id = Id;
this.RequestTimeStamp = RequestTimeStamp;
this.ItemCount = ItemCount;
}
}
package com.function;
import java.util.*;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.sql.annotation.SQLOutput;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Optional;
public class PostToDoWithLog {
@FunctionName("PostToDoWithLog")
public HttpResponseMessage run(
@HttpTrigger(name = "req", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
@SQLOutput(
name = "toDoItem",
commandText = "dbo.ToDo",
connectionStringSetting = "SqlConnectionString")
OutputBinding<ToDoItem> output,
@SQLOutput(
name = "requestLog",
commandText = "dbo.RequestLog",
connectionStringSetting = "SqlConnectionString")
OutputBinding<RequestLog> outputLog,
final ExecutionContext context) throws JsonParseException, JsonMappingException, JsonProcessingException {
context.getLogger().info("Java HTTP trigger processed a request.");
String json = request.getBody().get();
ObjectMapper mapper = new ObjectMapper();
ToDoItem newToDo = mapper.readValue(json, ToDoItem.class);
newToDo.Id = UUID.randomUUID();
output.setValue(newToDo);
RequestLog newLog = new RequestLog();
newLog.ItemCount = 1;
outputLog.setValue(newLog);
return request.createResponseBuilder(HttpStatus.CREATED).header("Content-Type", "application/json").body(output).build();
}
}
Azure SQL 出力バインドのその他のサンプルは、GitHub リポジトリで入手できます。
このセクションには、次の例が含まれています。
この例では、次のデータベース テーブルを参照します。
CREATE TABLE dbo.ToDo (
[Id] UNIQUEIDENTIFIER PRIMARY KEY,
[order] INT NULL,
[title] NVARCHAR(200) NOT NULL,
[url] NVARCHAR(200) NOT NULL,
[completed] BIT NOT NULL
);
HTTP トリガー、レコードをテーブルに書き込む
次の例は、HTTP POST 要求で JSON 本文として提供されるデータを使って、function.json ファイルでの SQL 出力バインドと、テーブルにレコードを追加する JavaScript 関数を示します。
function.json ファイルのバインド データを次に示します。
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "todoItems",
"type": "sql",
"direction": "out",
"commandText": "dbo.ToDo",
"connectionStringSetting": "SqlConnectionString"
}
これらのプロパティについては、「構成」セクションを参照してください。
JavaScript コードの例を次に示します。
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger and SQL output binding function processed a request.');
context.log(req.body);
if (req.body) {
context.bindings.todoItems = req.body;
context.res = {
body: req.body,
mimetype: "application/json",
status: 201
}
} else {
context.res = {
status: 400,
body: "Error reading request body"
}
}
}
HTTP トリガー、2 つのテーブルに書き込む
次の例では、HTTP POST 要求で JSON 本文として提供されるデータと、複数の出力バインドを使って、function.json ファイルでの SQL 出力バインドと、データベースの 2 つの異なるテーブル (dbo.ToDo
と dbo.RequestLog
) にレコードを追加する JavaScript 関数を示します。
2 番目のテーブル dbo.RequestLog
は、次の定義に対応します。
CREATE TABLE dbo.RequestLog (
Id int identity(1,1) primary key,
RequestTimeStamp datetime2 not null,
ItemCount int not null
)
function.json ファイルのバインド データを次に示します。
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "todoItems",
"type": "sql",
"direction": "out",
"commandText": "dbo.ToDo",
"connectionStringSetting": "SqlConnectionString"
},
{
"name": "requestLog",
"type": "sql",
"direction": "out",
"commandText": "dbo.RequestLog",
"connectionStringSetting": "SqlConnectionString"
}
これらのプロパティについては、「構成」セクションを参照してください。
JavaScript コードの例を次に示します。
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger and SQL output binding function processed a request.');
context.log(req.body);
const newLog = {
RequestTimeStamp = Date.now(),
ItemCount = 1
}
if (req.body) {
context.bindings.todoItems = req.body;
context.bindings.requestLog = newLog;
context.res = {
body: req.body,
mimetype: "application/json",
status: 201
}
} else {
context.res = {
status: 400,
body: "Error reading request body"
}
}
}
Azure SQL 出力バインドのその他のサンプルは、GitHub リポジトリで入手できます。
このセクションには、次の例が含まれています。
この例では、次のデータベース テーブルを参照します。
CREATE TABLE dbo.ToDo (
[Id] UNIQUEIDENTIFIER PRIMARY KEY,
[order] INT NULL,
[title] NVARCHAR(200) NOT NULL,
[url] NVARCHAR(200) NOT NULL,
[completed] BIT NOT NULL
);
HTTP トリガー、レコードをテーブルに書き込む
次の例は、HTTP POST 要求で JSON 本文として提供されるデータを使って、function.json ファイルでの SQL 出力バインドと、テーブルにレコードを追加する PowerShell 関数を示します。
function.json ファイルのバインド データを次に示します。
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "todoItems",
"type": "sql",
"direction": "out",
"commandText": "dbo.ToDo",
"connectionStringSetting": "SqlConnectionString"
}
これらのプロパティについては、「構成」セクションを参照してください。
run.ps1
ファイル内の関数の PowerShell コードの例を次に示します。
```powershell
using namespace System.Net
param($Request)
Write-Host "PowerShell function with SQL Output Binding processed a request."
# Update req_body with the body of the request
$req_body = $Request.Body
# Assign the value we want to pass to the SQL Output binding.
# The -Name value corresponds to the name property in the function.json for the binding
Push-OutputBinding -Name todoItems -Value $req_body
Push-OutputBinding -Name res -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $req_body
})
HTTP トリガー、2 つのテーブルに書き込む
次の例では、HTTP POST 要求で JSON 本文として提供されるデータと、複数の出力バインドを使って、function.json ファイルでの SQL 出力バインドと、データベースの 2 つの異なるテーブル (dbo.ToDo
と dbo.RequestLog
) にレコードを追加する PowerShell 関数を示します。
2 番目のテーブル dbo.RequestLog
は、次の定義に対応します。
CREATE TABLE dbo.RequestLog (
Id int identity(1,1) primary key,
RequestTimeStamp datetime2 not null,
ItemCount int not null
)
function.json ファイルのバインド データを次に示します。
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "todoItems",
"type": "sql",
"direction": "out",
"commandText": "dbo.ToDo",
"connectionStringSetting": "SqlConnectionString"
},
{
"name": "requestLog",
"type": "sql",
"direction": "out",
"commandText": "dbo.RequestLog",
"connectionStringSetting": "SqlConnectionString"
}
これらのプロパティについては、「構成」セクションを参照してください。
run.ps1
ファイル内の関数の PowerShell コードの例を次に示します。
using namespace System.Net
param($Request)
Write-Host "PowerShell function with SQL Output Binding processed a request."
# Update req_body with the body of the request
$req_body = $Request.Body
$new_log = @{
RequestTimeStamp = [DateTime]::Now
ItemCount = 1
}
Push-OutputBinding -Name todoItems -Value $req_body
Push-OutputBinding -Name requestLog -Value $new_log
Push-OutputBinding -Name res -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $req_body
})
Azure SQL 出力バインドのその他のサンプルは、GitHub リポジトリで入手できます。
このセクションには、次の例が含まれています。
この例では、次のデータベース テーブルを参照します。
CREATE TABLE dbo.ToDo (
[Id] UNIQUEIDENTIFIER PRIMARY KEY,
[order] INT NULL,
[title] NVARCHAR(200) NOT NULL,
[url] NVARCHAR(200) NOT NULL,
[completed] BIT NOT NULL
);
HTTP トリガー、レコードをテーブルに書き込む
次の例は、HTTP POST 要求で JSON 本文として提供されるデータを使って、function.json ファイルでの SQL 出力バインドと、テーブルにレコードを追加する Python 関数を示します。
function.json ファイルのバインド データを次に示します。
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"name": "todoItems",
"type": "sql",
"direction": "out",
"commandText": "dbo.ToDo",
"connectionStringSetting": "SqlConnectionString"
}
これらのプロパティについては、「構成」セクションを参照してください。
Python コードの例を次に示します。
import logging
import azure.functions as func
def main(req: func.HttpRequest, todoItems: func.Out[func.SqlRow]) -> func.HttpResponse:
logging.info('Python HTTP trigger and SQL output binding function processed a request.')
try:
req_body = req.get_json()
rows = list(map(lambda r: json.loads(r.to_json()), req_body))
except ValueError:
pass
if req_body:
todoItems.set(rows)
return func.HttpResponse(
todoItems.to_json(),
status_code=201,
mimetype="application/json"
)
else:
return func.HttpResponse(
"Error accessing request body",
status_code=400
)
HTTP トリガー、2 つのテーブルに書き込む
次の例では、HTTP POST 要求で JSON 本文として提供されるデータと、複数の出力バインドを使って、function.json ファイルでの SQL 出力バインドと、データベースの 2 つの異なるテーブル (dbo.ToDo
と dbo.RequestLog
) にレコードを追加する Python 関数を示します。
2 番目のテーブル dbo.RequestLog
は、次の定義に対応します。
CREATE TABLE dbo.RequestLog (
Id int identity(1,1) primary key,
RequestTimeStamp datetime2 not null,
ItemCount int not null
)
function.json ファイルのバインド データを次に示します。
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"name": "todoItems",
"type": "sql",
"direction": "out",
"commandText": "dbo.ToDo",
"connectionStringSetting": "SqlConnectionString"
},
{
"name": "requestLog",
"type": "sql",
"direction": "out",
"commandText": "dbo.RequestLog",
"connectionStringSetting": "SqlConnectionString"
}
これらのプロパティについては、「構成」セクションを参照してください。
Python コードの例を次に示します。
import logging
from datetime import datetime
import azure.functions as func
def main(req: func.HttpRequest, todoItems: func.Out[func.SqlRow], requestLog: func.Out[func.SqlRow]) -> func.HttpResponse:
logging.info('Python HTTP trigger and SQL output binding function processed a request.')
try:
req_body = req.get_json()
rows = list(map(lambda r: json.loads(r.to_json()), req_body))
except ValueError:
pass
requestLog.set(func.SqlRow({
"RequestTimeStamp": datetime.now(),
"ItemCount": 1
}))
if req_body:
todoItems.set(rows)
return func.HttpResponse(
todoItems.to_json(),
status_code=201,
mimetype="application/json"
)
else:
return func.HttpResponse(
"Error accessing request body",
status_code=400
)
属性
C# ライブラリでは SqlAttribute 属性を使用して、次のプロパティを持つ関数で SQL バインディングを宣言します。
属性のプロパティ | 説明 |
---|---|
CommandText | 必須。 バインドによって書き込まれるテーブルの名前。 |
ConnectionStringSetting | 必須。 データの書き込み先のデータベースの接続文字列を含むアプリ設定の名前。 これは実際の接続文字列ではなく、代わりに環境変数に解決される必要があります。 |
注釈
Java 関数ランタイム ライブラリで、その値が Azure SQL に由来するパラメーター上で @SQLOutput
注釈 (com.microsoft.azure.functions.sql.annotation.SQLOutput
) を使用します。 この注釈は、次の要素をサポートします。
要素 | 説明 |
---|---|
commandText | 必須。 バインドによって書き込まれるテーブルの名前。 |
connectionStringSetting | 必須。 データの書き込み先のデータベースの接続文字列を含むアプリ設定の名前。 これは実際の接続文字列ではなく、代わりに環境変数に解決される必要があります。 |
name | 必須。 関数バインドの一意の名前。 |
構成
次の表は、function.json ファイルで設定したバインド構成のプロパティを説明しています。
function.json のプロパティ | 説明 |
---|---|
type | 必須。 sql に設定する必要があります。 |
direction | 必須。 out に設定する必要があります。 |
name | 必須。 関数のコードでエンティティを表す変数の名前。 |
commandText | 必須。 バインドによって書き込まれるテーブルの名前。 |
connectionStringSetting | 必須。 データの書き込み先のデータベースの接続文字列を含むアプリ設定の名前。 これは実際の接続文字列ではなく、代わりに環境変数に解決される必要があります。 接続文字列値の省略可能なキーワードは、SQL バインドの接続を調整するために使用できます。 |
ローカルで開発する場合は、 コレクション内の local.settings.json ファイルにアプリケーション設定を追加します。
使用
CommandText
プロパティは、データを格納するテーブルの名前です。 接続文字列設定名は、Azure SQL または SQL Server インスタンスに対する接続文字列を含むアプリケーション設定に合致します。
出力バインドでは、ターゲット データベースに対する SELECT アクセス許可が必要な T-SQL MERGE ステートメントを使用します。