หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Overview
SQL Bindings for Visual Studio Code lets you develop Azure Functions with Azure SQL bindings. For more information, see Create Azure Functions with the SQL Bindings extension for Visual Studio Code. To install the extension, see SQL Bindings extension for Visual Studio Code.
From the Object Explorer
To create an Azure Function from a specific table or view in Object Explorer, right-click on a table or view from a connected server in SQL Server Object Explorer and select Create Azure Function with SQL Binding.
Table Object Explorer command:
View Object Explorer command:
If you haven't yet created the Azure Function project, a Visual Studio Code prompt appears to aid in creating a new Azure Function project.
The extension then asks you to select the folder where you want to create the Azure Function.
If you're creating an Azure Function with SQL binding from a table, the extension prompts you to select the binding type to use, either an Input (Retrieves data from a database) or Output (Save data to a database) binding.
Note
Azure Function with SQL Binding from a view supports only Input bindings.
The extension then prompts you to enter the function name to use for the Azure Function.
If you already have connection strings stored in the local.settings.json, the extension prompts you to select the connection string to use for the Azure Function or create a new connection string.
If you select Create new local app setting, the extension prompts you to enter the connection string name and value.
If you're creating the Azure Function with SQL Binding to an existing Azure Function project, the extension prompts you whether you want to include the password for the connection string in the local.settings.json file.
If you select Yes, the password is saved to the local.settings.json file. If you select No, the extension warns you that the password isn't saved to the local.settings.json file (shown in this example), and you need to manually add the password to this file later.
The extension then prompts you to provide the namespace for the Azure Function.
If you're creating a brand new Azure Function project with SQL binding, the extension prompts whether you want to include the password for the connection string in the local.settings.json file.
A progress notification appears to indicate that the Azure Function is complete.
Once the Azure Function is created, the extension generates the code for either an Input or Output binding. For more information, see Generated code for Azure functions with SQL bindings.