SQL Server

Microsoft SQL Server is a relational database management system developed by Microsoft. Connect to SQL Server to manage data. You can perform various actions such as create, update, get, and delete on rows in a table.
This connector is available in the following products and regions:
Service | Class | Regions |
---|---|---|
Logic Apps | Standard | All Logic Apps regions and Integration Service Environments (ISEs) |
Power Automate | Premium | All Power Automate regions |
Power Apps | Premium | All Power Apps regions |
Connector Metadata | |
---|---|
Publisher | Microsoft |
Ensure your account is correctly set up and provisioned as a SQL AAD user prior to using Active Directory authentication in the SQL Server connector. Follow these instructions to do so.
Note that if you are using non-AAD connection types you should provide the same Server name/Database name as it defined in connection (or Use connection settings option).
To use this connector in Power Apps, learn more here.
Known issues and limitations
The followings are some of the known limitations of using SQL connector
- Stored Procedures cannot be invoked from Power Apps.
- One workaround is to create a flow and invoke the flow from Power Apps.
- Insert and update to a table does not work if you have a SQL Server side Trigger defined on the table. To workaround this issue, you can do either of the following:
- Use a Stored Procedure or Native Query
- Remove the Trigger from your SQL table
- When invoking a Stored Procedure on an on-premises SQL Server, we have the following limitations:
- Output values for OUTPUT parameters are not returned. You can still specify input values for OUTPUT parameters.
- Return value is not available.
- Only the first result set is returned.
- Dynamics schemas are not supported for result sets.
- A Primary Key is required for the following operations:
- GetItem
- UpdateItem
- DeleteItem
- When invoking triggers, we have the following limitations:
- A ROWVERSION column is required for OnUpdatedItems
- An IDENTITY column is required for OnNewItems
- The response size limit is 8MB through on-premises SQL Server.
- The request size limit is 2MB through on-premises SQL Server.
- SQL native query is not supported for on-premises SQL Server.
- The minimum supported version for on-premises SQL Server is SQL Server 2005.
- The following data types cannot be used as query option predicates:
- date
- datetime
- datetime2
- smalldatetime
- Currently multiple result sets support is limited for SQL native query execution: only result sets, up to the first empty one result set, will be returned. As a workaround Stored Procedure usage is proposed.
- The result set schema after executing SQL queries and stored procedures should contain unique non-empty column names.
- The result set schema for any operation inside the stored procedure that returns some set of results (e.g. any inner SELECT statement) should contain unique non-empty column names.
- If SQL query/stored procedure execution time exceeds 110 seconds, actions will timeout.
- For INSERT and UPDATE operations, the connector will return the updated rows. This requires that the connection will need to have permission to read data from the SQL Server as well.
- Private endpoint of SQL Server can only be accessed within ISE. For more information, see Logic Apps documentation.
- Setting "Force Encryption" is not supported. By default, SQL Database and SQL Managed Instance secure customer data by encrypting data in motion with Transport Layer Security (TLS). For more information, see Azure SQL Security Overview.
- Using Service Principal to connect to SQL Server is not supported.
- Due to current authentication pipeline limitations AAD Guest users are not supported to use AAD type connections to SQL Server. As a workaround please use Sql/Windows auth type connections.
Special throttling limits
SQL connector has different throttling limits in different cases. In the following table, Native operations include SQL stored procedure and SQL Query; CRUD are for Create, Read, Update and Delete operations.
Service | Environment | Operations | Name | Calls | Renewal Period |
---|---|---|---|---|---|
Power Apps | Shared Environment | All | API calls per user | 300 | 30 |
Logic Apps & Power Automate | Shared Environment | Native | API calls per connection | 500 | 10 |
Logic Apps & Power Automate | Shared Environment | CRUD | API calls per connection | 100 | 10 |
Logic Apps & Power Automate | Shared Environment | Native | Concurrent calls | 200 | - |
Logic Apps & Power Automate | Shared Environment | CRUD | Concurrent calls | 125 | - |
Power Apps data type mappings
SQL Server | Power Apps |
---|---|
bigint, decimal, int, money, numeric, smallint, smallmoney, tinyint, float, real | Number |
char, nchar, varchar, nvarchar, text, ntext | Text |
bit | Boolean |
date, datetime/datetime2/smalldatetime, datetimeoffset, time | DateTime |
uniqueidentifier | Guid |
Note
If a SQL Server data type is not listed in the table above, it is not supported. Examples of unsupported SQL Server data types include: binary(), varbinary(), image, cursor, rowversion, hierarchyid, sql_variant xml, Spatial Geometry Types, Spatial Geography Types, and table.
Power Apps delegable functions and operations for SQL Server
These Power Apps operations, for a given data type, may be delegated to SQL Server for processing (rather than processing locally within Power Apps).
Operation/Function | Number | Text | Boolean | DateTime | Guid |
---|---|---|---|---|---|
Filter | Yes | Yes | Yes | No [1] | Yes |
Sort | Yes | Yes | Yes | Yes | - |
SortByColumns | Yes | Yes | Yes | Yes | - |
Search | No | Yes | No | No | - |
Lookup | Yes | Yes | Yes | Yes | Yes |
=, <> | Yes | Yes | Yes | No | Yes |
<, <=, >, >= | Yes | No | No | No | - |
in (substring) | - | Yes [2] | - | - | - |
+ | Yes | - | - | No | - |
- | Yes | - | - | No | - |
* | Yes | - | - | No | - |
/ | Yes | - | - | No | - |
StartsWith | - | Yes [3] | - | - | - |
EndsWith | - | Yes [4] | - | - | - |
IsBlank | No [5] | No [5] | No [5] | No [5] | No [5] |
Len (length) | - | Yes [6] | - | - | - |
Sum | Yes | - | - | - | - |
Average | Yes | - | - | - | - |
Min | Yes | - | - | No | - |
Max | Yes | - | - | No | - |
Note
Expressions joined with And, Or, and Not are delegable to SQL Server.
- Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column.
- The 'in' (substring) operator. Supported for ("string value" in <column>), but not for (<column> in "string value").
- StartsWith. Supported for (StartsWith(<column>, "string value")), but not for (StartsWith("string value", <column>)).
- EndsWith. Supported for (EndsWith(<column>, "string value")) but not for (EndsWith("string value", <column>)). If a char(10) column has a value of "hello", EndsWith(<column>, "llo") will return false, and that's by design. A char(10) column has 10 characters.
- An expression such as Filter('[dbo].[MyOrders]', !IsBlank(CustomerId)) won't delegate to the server. However, this is semantically close to Filter('[dbo].[MyOrders]', CustomerId <> Blank()), which does delegate to the server. These expressions differ in that the second expression won't treat the empty string ("") as Empty. These expressions aren't equivalent, but the latter might work for your purposes. You can’t use this method for the Guid data type.
- Len. Power Apps delegates the Len function, but it might not work as you expect. A char(10) column with value "hello" will always have, in SQL Server, a length of 10. But Power Apps will treat that string as having a length of 5, which could cause discrepancies and confusion. You shouldn't use char/nchar on the server; use varchar/nvarchar instead.
Get rows (V2) action Aggregation transformation parameter detail
Only the following Aggregation transformations are supported:
filter - Allows filtering input set. Supports the same expressions as
$filter
Example:filter(ColName1 eq 1)
aggregate - Allows aggregation using one of following methods:
average
,max
,min
,sum
,countdistinct
Example:aggregate(ColName2 with max as MaxValue)
You can combine several operators separated by forward slashes to express that they are consecutively applied, i.e. the result of each transformation is the input to the next transformation.
E.g. filter(ColName1 eq 4)/aggregate(ColName2 with sum as MaxWorkItemId)
Using formalParameters
Execute a SQL query [DEPRECATED]
and Execute a SQL query (V2)
actions allows usage of formal parameters. They are defined as key-value pairs, where key is parameter name and value is SQL data type (like INT
or NVARCHAR(255)
). Once name and data type is defined, a new input field for a value will be shown.
Connector in-depth
For more information about the connector, see the in-dept section.
Creating a connection
The connector supports the following authentication types:
Azure AD Integrated | Use Azure Active Directory to access your SQL database. | All regions except US Government (GCC) |
Azure AD Integrated (Azure Commercial) | Use Azure Active Directory to access your SQL database in Azure Commercial. | US Government (GCC) only |
Azure AD Integrated (Azure Government) | Use Azure Active Directory to access your SQL database in Azure Government. | US Government (GCC) only |
SQL Server Authentication | Use an account name and password to access your SQL database. | All regions |
Windows Authentication | Use an on-premise Active Directory account name and password to access your SQL database. | All regions |
Default [DEPRECATED] | This option is only for older connections without an explicit authentication type, and is only provided for backward compatibility. | All regions |
Azure AD Integrated
Auth ID: oauth
Applicable: All regions except US Government (GCC)
Use Azure Active Directory to access your SQL database.
Azure AD Integrated (Azure Commercial)
Auth ID: oauthCom
Applicable: US Government (GCC) only
Use Azure Active Directory to access your SQL database in Azure Commercial.
Azure AD Integrated (Azure Government)
Auth ID: oauth
Applicable: US Government (GCC) only
Use Azure Active Directory to access your SQL database in Azure Government.
SQL Server Authentication
Auth ID: sqlAuthentication
Applicable: All regions
Use an account name and password to access your SQL database.
Name | Type | Description |
---|---|---|
SQL server name | string | Specify the name of the SQL server (server[:port]) |
SQL database name | string | SQL database name |
Username | securestring | Username credential |
Password | securestring | Password credential |
Gateway | gatewaySetting | On-prem gateway (see https://docs.microsoft.com/data-integration/gateway for more details) |
Windows Authentication
Auth ID: windowsAuthentication
Applicable: All regions
Use an on-premise Active Directory account name and password to access your SQL database.
Name | Type | Description |
---|---|---|
SQL server name | string | Specify the name of the SQL server (server[:port]) |
SQL database name | string | SQL database name |
Username | securestring | Username credential |
Password | securestring | Password credential |
Gateway | gatewaySetting | On-prem gateway (see https://docs.microsoft.com/data-integration/gateway for more details) |
Default [DEPRECATED]
Applicable: All regions
This option is only for older connections without an explicit authentication type, and is only provided for backward compatibility.
Name | Type | Description |
---|---|---|
SQL server name | string | SQL server name |
SQL database name | string | SQL database name |
Authentication Type | string | Authentication type to connect to your database |
Username | securestring | Username credential |
Password | securestring | Password credential |
Gateway | gatewaySetting | On-prem gateway (see https://docs.microsoft.com/data-integration/gateway for more details) |
Throttling Limits
Name | Calls | Renewal Period |
---|---|---|
API calls per connection | 100 | 10 seconds |
Actions
Delete row (V2) |
This operation deletes a row from a table. |
Delete row [DEPRECATED] |
This action has been deprecated. Please use Delete row (V2) instead.
|
Execute a SQL query (V2) |
Execute a SQL query (V2) |
Execute a SQL query [DEPRECATED] |
This action has been deprecated. Please use Execute a SQL query (V2) instead.
|
Execute stored procedure (V2) |
This operation runs a stored procedure. |
Execute stored procedure [DEPRECATED] |
This action has been deprecated. Please use Execute stored procedure (V2) instead.
|
Get row (V2) |
This operation gets a row from a table. |
Get row [DEPRECATED] |
This action has been deprecated. Please use Get row (V2) instead.
|
Get rows (V2) |
This operation gets rows from a table. |
Get rows [DEPRECATED] |
This action has been deprecated. Please use Get rows (V2) instead.
|
Get tables (V2) |
This operation gets tables from a database. |
Get tables [DEPRECATED] |
This action has been deprecated. Please use Get tables (V2) instead.
|
Insert row (V2) |
This operation inserts a new row into a table. |
Insert row [DEPRECATED] |
This action has been deprecated. Please use Insert row (V2) instead.
|
Transform data using Power Query |
Transform data using Power Query. Note: This operation does not work when connecting using Sql Azure AD. |
Update row (V2) |
This operation updates an existing row in a table. |
Update row [DEPRECATED] |
This action has been deprecated. Please use Update row (V2) instead.
|
Delete row (V2)
This operation deletes a row from a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of table |
Row id
|
id | True | string |
Unique identifier of the row to delete |
Delete row [DEPRECATED]
This action has been deprecated. Please use Delete row (V2) instead.
This operation deletes a row from a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of table |
Row id
|
id | True | string |
Unique identifier of the row to delete |
Execute a SQL query (V2)
Execute a SQL query (V2)
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Query
|
query | True | dynamic |
query body |
Returns
Execute a SQL query [DEPRECATED]
This action has been deprecated. Please use Execute a SQL query (V2) instead.
Execute a SQL query
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Query
|
query | True | dynamic |
query body |
Returns
Execute stored procedure (V2)
This operation runs a stored procedure.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Procedure name
|
procedure | True | string |
Name of stored procedure |
Parameters list
|
parameters | True | dynamic |
Input parameters to the stored procedure |
Returns
Execute stored procedure [DEPRECATED]
This action has been deprecated. Please use Execute stored procedure (V2) instead.
This operation runs a stored procedure.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Procedure name
|
procedure | True | string |
Name of stored procedure |
Parameters list
|
parameters | True | dynamic |
Input parameters to the stored procedure |
Returns
Get row (V2)
This operation gets a row from a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of SQL table |
Row id
|
id | True | string |
Unique identifier of the row to retrieve |
Returns
Get row [DEPRECATED]
This action has been deprecated. Please use Get row (V2) instead.
This operation gets a row from a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of SQL table |
Row id
|
id | True | string |
Unique identifier of the row to retrieve |
Returns
Get rows (V2)
This operation gets rows from a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of SQL table |
Aggregation transformation
|
$apply | string |
A sequence of OData aggregation transformations |
|
Filter Query
|
$filter | string |
An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). |
|
Order By
|
$orderby | string |
An ODATA orderBy query for specifying the order of entries. |
|
Skip Count
|
$skip | integer |
The number of entries to skip (default = 0). |
|
Top Count
|
$top | integer |
Total number of entries to retrieve (default = all). |
|
Select Query
|
$select | string |
Specific fields to retrieve from entries (default = all). |
Returns
Get rows [DEPRECATED]
This action has been deprecated. Please use Get rows (V2) instead.
This operation gets rows from a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of SQL table |
Aggregation transformation
|
$apply | string |
A sequence of OData aggregation transformations |
|
Filter Query
|
$filter | string |
An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). |
|
Order By
|
$orderby | string |
An ODATA orderBy query for specifying the order of entries. |
|
Skip Count
|
$skip | integer |
The number of entries to skip (default = 0). |
|
Top Count
|
$top | integer |
Total number of entries to retrieve (default = all). |
|
Select Query
|
$select | string |
Specific fields to retrieve from entries (default = all). |
Returns
Get tables (V2)
This operation gets tables from a database.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Returns
Represents a list of tables.
- Body
- TablesList
Get tables [DEPRECATED]
This action has been deprecated. Please use Get tables (V2) instead.
This operation gets tables from a database.
Returns
Represents a list of tables.
- Body
- TablesList
Insert row (V2)
This operation inserts a new row into a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of table |
Row
|
item | True | dynamic |
Row to insert into the specified table |
Returns
Insert row [DEPRECATED]
This action has been deprecated. Please use Insert row (V2) instead.
This operation inserts a new row into a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of table |
Row
|
item | True | dynamic |
Row to insert into the specified table |
Returns
Transform data using Power Query
Transform data using Power Query. Note: This operation does not work when connecting using Sql Azure AD.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
query
|
query | mquery |
Query Text |
Returns
Update row (V2)
This operation updates an existing row in a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of table |
Row id
|
id | True | string |
Unique identifier of the row to update |
Row
|
item | True | dynamic |
Row with updated values |
Returns
Update row [DEPRECATED]
This action has been deprecated. Please use Update row (V2) instead.
This operation updates an existing row in a table.
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of table |
Row id
|
id | True | string |
Unique identifier of the row to update |
Row
|
item | True | dynamic |
Row with updated values |
Returns
Triggers
When an item is created (V2) |
Triggers a flow when an item is created in Sql |
When an item is created [DEPRECATED] |
This action has been deprecated. Please use When an item is created (V2) instead.
|
When an item is modified (V2) |
Triggers a flow when an item is modified in Sql |
When an item is modified [DEPRECATED] |
This action has been deprecated. Please use When an item is modified (V2) instead.
|
When an item is created (V2)
Triggers a flow when an item is created in Sql
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of Sql table |
Filter Query
|
$filter | string |
An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). |
|
Top Count
|
$top | integer |
Total number of entries to retrieve (default = all). |
|
Order By
|
$orderby | string |
An ODATA orderBy query for specifying the order of entries. |
|
Select Query
|
$select | string |
Specific fields to retrieve from entries (default = all). |
Returns
When an item is created [DEPRECATED]
This action has been deprecated. Please use When an item is created (V2) instead.
Triggers a flow when an item is created in Sql
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of Sql table |
Filter Query
|
$filter | string |
An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). |
|
Top Count
|
$top | integer |
Total number of entries to retrieve (default = all). |
|
Order By
|
$orderby | string |
An ODATA orderBy query for specifying the order of entries. |
|
Select Query
|
$select | string |
Specific fields to retrieve from entries (default = all). |
Returns
When an item is modified (V2)
Triggers a flow when an item is modified in Sql
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Server name
|
server | True | string |
Name of SQL server |
Database name
|
database | True | string |
Database name |
Table name
|
table | True | string |
Name of Sql table |
Filter Query
|
$filter | string |
An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). |
|
Top Count
|
$top | integer |
Total number of entries to retrieve (default = all). |
|
Order By
|
$orderby | string |
An ODATA orderBy query for specifying the order of entries. |
|
Select Query
|
$select | string |
Specific fields to retrieve from entries (default = all). |
Returns
When an item is modified [DEPRECATED]
This action has been deprecated. Please use When an item is modified (V2) instead.
Triggers a flow when an item is modified in Sql
Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
Table name
|
table | True | string |
Name of Sql table |
Filter Query
|
$filter | string |
An ODATA filter query to restrict the entries returned (e.g. stringColumn eq 'string' OR numberColumn lt 123). |
|
Top Count
|
$top | integer |
Total number of entries to retrieve (default = all). |
|
Order By
|
$orderby | string |
An ODATA orderBy query for specifying the order of entries. |
|
Select Query
|
$select | string |
Specific fields to retrieve from entries (default = all). |
Returns
Definitions
TablesList
Represents a list of tables.
Name | Path | Type | Description |
---|---|---|---|
value
|
value | array of Table |
List of Tables |
Table
Represents a table.
Name | Path | Type | Description |
---|---|---|---|
Name
|
Name | string |
The name of the table. The name is used at runtime. |
DisplayName
|
DisplayName | string |
The display name of the table. |
DynamicProperties
|
DynamicProperties | object |
Additional table properties provided by the connector to the clients. |