You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/cds-sql-query.md
+50-24Lines changed: 50 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Use SQL to query data (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
3
description: "Learn how to query Microsoft Dataverse entity data using SQL."# 115-145 characters including spaces. This abstract displays in the search result.
> This feature has been re-enabled in the majority of regions. Please resume testing, and provide feedback. We thank you for your patience and feedback.
27
-
28
-
29
-
A SQL data connection is available on the Microsoft Dataverse endpoint. The SQL connection provides read-only access to the entity data of the target Dataverse environment. This allows you to write and execute SQL queries against the entity data table. Table columns provide the attribute data of the entity. No custom views of the data have been provided.
26
+
> This feature has been re-enabled in the majority of regions. Please resume testing, and provide feedback. We thank you for your patience and feedback.<p/>
A SQL data connection is available on the Microsoft Dataverse endpoint. The SQL connection provides read-only access to the entity data of the target Dataverse environment. This allows you to execute SQL queries against the entity data table. Table columns provide the attribute data of the entity. No custom views of the data have been provided.
31
30
31
+
## Applications support
32
32
33
-
> [!IMPORTANT]
34
-
> - This is a preview feature, and isn't available in all regions.
> - Instructions to enable the feature can be found here: [View entity data in Power BI Desktop](/powerapps/maker/common-data-service/view-entity-data-power-bi), and [Manage feature settings](/power-platform/admin/settings-features) (see TDS endpoint setting).
33
+
TDS (SQL) endpoint applications support for Power Apps and SQL Server Management Studio is described below.
37
34
38
-
##Applications support
35
+
### Power Apps
39
36
40
-
You can use the **Analyze in Power BI** option (**Data** > **Entities** > **Analyze in Power BI**) in Power Apps (https://make.powerapps.com) to use the SQL connection feature to analyze data in Power BI Desktop. More information: [View entity data in Power BI Desktop](/powerapps/maker/common-data-service/view-entity-data-power-bi)
37
+
You can use the **Analyze in Power BI** option (**Data** > **Entities** > **Analyze in Power BI**) in Power Apps (https://make.powerapps.com) to use the Dataverse connector to analyze data in Power BI Desktop. More information: [View entity data in Power BI Desktop](/powerapps/maker/common-data-service/view-entity-data-power-bi)
41
38
42
39
> [!NOTE]
43
-
> To verify if your target environment has the Dataverse SQL connection feature enabled, do the following:
44
-
> 1. Sign into Power Apps, on the left navigation pane expand **Data**, and then select **Entities**.
45
-
> 2. On the command bar, you should see a button **Analyze in Power BI**. If you do not see this button, your environment does not yet have the feature.
40
+
> To enable this feature, see the TDS endpoint setting in [Manage feature settings](/power-platform/admin/settings-features). Once enabled you should see a button **Analyze in Power BI** in the command bar of Power Apps.
41
+
42
+
### SQL Server Management Studio
46
43
47
44
You can also use [SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms) (SSMS) version 18.4 or later with the Dataverse endpoint SQL connection. Examples of using SSMS with the SQL data connection are provided below.
48
45
@@ -52,10 +49,13 @@ You can also use [SQL Server Management Studio](/sql/ssms/download-sql-server-ma
52
49
53
50
The Dataverse endpoint SQL connection uses the Dataverse security model for data access. Data can be obtained for all entities to which a user has access to in Dataverse.
54
51
55
-
Only Azure Active Directory authentication is supported. SQL authentication and Windows authentication are not supported. Below is an example of how to logon to the SQL connection in SSMS. Notice the server name is the organization address URL followed by a comma and the port value of 5558.
52
+
Only Azure Active Directory authentication is supported. SQL authentication and Windows authentication are not supported. Below is an example of how to logon to the SQL connection in SSMS. Notice the server name is the organization address URL.
56
53
57
54

58
55
56
+
> [!NOTE]
57
+
> The requirement to specify a port number after the service URL has been removed.
58
+
59
59
## Example entity data queries
60
60
61
61
Below are a couple of example queries composed in SSMS. The first image shows a simple query using aliases and result ordering.
@@ -76,13 +76,7 @@ select name, fullname from account a inner join contact c on a.primarycontactid
76
76
77
77
## Supported operations and data types
78
78
79
-
The list of supported SQL operations includes:
80
-
81
-
- Batch operations
82
-
- SELECT
83
-
- Aggregation functions (i.e., Count() and Max() functions)
84
-
- UNIONs and JOINs
85
-
- Filtering
79
+
For a detailed list of supported SQL operations on the Dataverse endpoint see [How Dataverse SQL differs from Transact-SQL](how-cds-sql-differs-from-transact-sql.md).
86
80
87
81
Any operation that attempts to modify data (i.e., INSERT, UPDATE) will not work as this is a read-only SQL data connection. Dataverse option sets are represented as \<OptionSet\>Name and \<OptionSet\>Label in a result set.
88
82
@@ -99,10 +93,42 @@ The following Dataverse datatypes are not supported with the SQL connection: `bi
99
93
> group by act.activityid, act.subject
100
94
> ```
101
95
102
-
## Plug-ins
96
+
## Limitations
97
+
98
+
There is an 80MB maximum size limit for query results returned from the Dataverse endpoint. Consider using data integration tools such as [Data Export Service](https://docs.microsoft.com/powerapps/developer/common-data-service/data-export-service) and [dataflows](https://docs.microsoft.com/power-bi/transform-model/dataflows/dataflows-introduction-self-service) for large data queries that return over 80MB of data. More information: [Importing and exporting data](/powerapps/maker/common-data-service/why-cds-import-export)
99
+
100
+
Dates returned in query results are formatted as Universal Time Coordinated (UTC). Previously, dates were returned in local time.
101
+
102
+
> [!NOTE]
103
+
> Until a service update planned for January 2021 has deployed, using date filters will be slow.
103
104
104
105
Querying data using SQL does not trigger any plug-ins registered on the <xref:Microsoft.Xrm.Sdk.Messages.RetrieveMultipleRequest> or <xref:Microsoft.Xrm.Sdk.Messages.RetrieveRequest> messages. Any re-writing of the query or results that would normally be performed by such a plug-in will therefore not take effect for a SQL query.
105
106
107
+
Queries using the TDS endpoint execute under the service protection API limits.
108
+
109
+
## Troubleshooting authentication problems
110
+
111
+
Only Azure Active Directory authentication is supported on the Dataverse endpoint SQL connection. The preferred authentication mechanism is "Azure Active Directory – Universal" with multi-factor authentication (MFA). However, "Azure Active Directory – Password" will work if MFA is not configured. If you try to use other forms of authentication, you will see errors like the following.
112
+
113
+
- Error returned when using **Azure Active Directory – Integrated** authentication.
114
+
115
+
“Login failed: The HTTP request was forbidden with client authentication scheme 'Anonymous'.
0 commit comments