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
description: Get connected to Azure SQL Data Warehouse.
2
+
title: Connect to Synapse SQL pool
3
+
description: Get connected to SQL pool.
4
4
services: synapse-analytics
5
5
author: XiaoyuMSFT
6
6
manager: craigg
@@ -13,21 +13,23 @@ ms.reviewer: igorstan
13
13
ms.custom: seo-lt-2019
14
14
---
15
15
16
-
# Connect to Azure SQL Data Warehouse
17
-
Get connected to Azure SQL Data Warehouse.
16
+
# Connect to Synapse SQL pool
17
+
Get connected to SQL pool.
18
18
19
19
## Find your server name
20
-
The server name in the following example is samplesvr.database.windows.net. To find the fully qualified server name:
20
+
The server name in the following example is sqlpoolservername.database.windows.net. To find the fully qualified server name:
21
21
22
-
1. Go to the [Azure portal][Azure portal].
23
-
2. Click on **SQL data warehouses**.
24
-
3. Click on the data warehouse you want to connect to.
22
+
1. Go to the [Azure portal](https://portal.azure.com).
23
+
2. Click on **Azure Synapse Analytics**.
24
+
3. Click on the SQL pool you want to connect to.
25
25
4. Locate the full server name.
26
26
27
27

28
28
29
29
## Supported drivers and connection strings
30
-
Azure SQL Data Warehouse supports [ADO.NET][ADO.NET], [ODBC][ODBC], [PHP][PHP], and [JDBC][JDBC]. To find the latest version and documentation, click on one of the preceding drivers. To automatically generate the connection string for the driver that you are using from the Azure portal, click on the **Show database connection strings** from the preceding example. Following are also some examples of what a connection string looks like for each driver.
30
+
SQL pool supports [ADO.NET](https://msdn.microsoft.com/library/e80y5yhx(v=vs.110).aspx), [ODBC](https://msdn.microsoft.com/library/jj730314.aspx), [PHP](https://msdn.microsoft.com/library/cc296172.aspx?f=255&MSPPError=-2147217396), and [JDBC](https://msdn.microsoft.com/library/mt484311(v=sql.110).aspx). To find the latest version and documentation, click on one of the preceding drivers.
31
+
32
+
To automatically generate the connection string for the driver that you are using from the Azure portal, click on the **Show database connection strings** from the preceding example. Following are also some examples of what a connection string looks like for each driver.
31
33
32
34
> [!NOTE]
33
35
> Consider setting the connection timeout to 300 seconds to allow your connection to survive short periods of unavailability.
To connect and query with Visual Studio, see [Query with Visual Studio][Query with Visual Studio]. To learn more about authentication options, see [Authentication to Azure SQL Data Warehouse][Authentication to Azure SQL Data Warehouse].
69
-
70
-
<!--Articles-->
71
-
[Query with Visual Studio]:sql-data-warehouse-query-visual-studio.md
72
-
[Authentication to Azure SQL Data Warehouse]:sql-data-warehouse-authentication.md
To connect and query with Visual Studio, see [Query with Visual Studio](sql-data-warehouse-query-visual-studio.md). To learn more about authentication options, see [Authentication to Azure Synapse Analytics](sql-data-warehouse-authentication.md).
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-develop-dynamic-sql.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Using dynamic SQL
3
-
description: Tips for using dynamic SQL in Azure SQL Data Warehouse for developing solutions.
3
+
description: Tips for development solutions using dynamic SQL in Synapse SQL pool.
4
4
services: synapse-analytics
5
5
author: XiaoyuMSFT
6
6
manager: craigg
@@ -13,12 +13,16 @@ ms.reviewer: igorstan
13
13
ms.custom: seo-lt-2019
14
14
---
15
15
16
-
# Dynamic SQL in SQL Data Warehouse
17
-
Tips for using dynamic SQL in Azure SQL Data Warehouse for developing solutions.
16
+
# Dynamic SQL in Synapse SQL pool
17
+
Included in this article are tips for development solutions using dynamic SQL in SQL pool.
18
18
19
19
## Dynamic SQL Example
20
20
21
-
When developing application code for SQL Data Warehouse, you may need to use dynamic sql to help deliver flexible, generic, and modular solutions. SQL Data Warehouse does not support blob data types at this time. Not supporting blob data types might limit the size of your strings since blob data types include both varchar(max) and nvarchar(max) types. If you have used these types in your application code to build large strings, you need to break the code into chunks and use the EXEC statement instead.
21
+
When developing application code for SQL pool, you may need to use dynamic SQL to help deliver flexible, generic, and modular solutions. SQL pool doesn't support blob data types at this time.
22
+
23
+
Not supporting blob data types might limit the size of your strings since blob data types include both varchar(max) and nvarchar(max) types.
24
+
25
+
If you've used these types in your application code to build large strings, you need to break the code into chunks and use the EXEC statement instead.
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-develop-group-by-options.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Using group by options
3
-
description: Tips for implementing group by options in Azure SQL Data Warehouse for developing solutions.
3
+
description: Tips for implementing group by options in Synapse SQL pool.
4
4
services: synapse-analytics
5
5
author: XiaoyuMSFT
6
6
manager: craigg
@@ -13,21 +13,21 @@ ms.reviewer: igorstan
13
13
ms.custom: seo-lt-2019
14
14
---
15
15
16
-
# Group by options in SQL Data Warehouse
17
-
Tips for implementing group by options in Azure SQL Data Warehouse for developing solutions.
16
+
# Group by options in Synapse SQL pool
18
17
19
-
## What does GROUP BY do?
18
+
In this article, you'll find tips for implementing group by options in SQL pool.
20
19
21
-
The [GROUP BY](/sql/t-sql/queries/select-group-by-transact-sql) T-SQL clause aggregates data to a summary set of rows. GROUP BY has some options that SQL Data Warehouse does not support. These options have workarounds.
20
+
## What does GROUP BY do?
22
21
23
-
These options are
22
+
The [GROUP BY](/sql/t-sql/queries/select-group-by-transact-sql) T-SQL clause aggregates data to a summary set of rows. GROUP BY has some options that SQL pool doesn't support. These options have workarounds, which are as follows:
24
23
25
24
* GROUP BY with ROLLUP
26
25
* GROUPING SETS
27
26
* GROUP BY with CUBE
28
27
29
28
## Rollup and grouping sets options
30
-
The simplest option here is to use UNION ALL instead to perform the rollup rather than relying on the explicit syntax. The result is exactly the same
29
+
30
+
The simplest option here is to use UNION ALL to perform the rollup rather than relying on the explicit syntax. The result is exactly the same.
31
31
32
32
The following example using the GROUP BY statement with the ROLLUP option:
33
33
```sql
@@ -79,11 +79,11 @@ JOIN dbo.DimSalesTerritory t ON s.SalesTerritoryKey = t.SalesTerritor
79
79
To replace GROUPING SETS, the sample principle applies. You only need to create UNION ALL sections for the aggregation levels you want to see.
80
80
81
81
## Cube options
82
-
It is possible to create a GROUP BY WITH CUBE using the UNION ALL approach. The problem is that the code can quickly become cumbersome and unwieldy. To mitigate this, you can use this more advanced approach.
82
+
It's possible to create a GROUP BY WITH CUBE using the UNION ALL approach. The problem is that the code can quickly become cumbersome and unwieldy. To mitigate this issue, you can use this more advanced approach.
83
83
84
-
Let's use the example above.
84
+
Using the previous example, the first step is to define the 'cube' that defines all the levels of aggregation that we want to create.
85
85
86
-
The first step is to define the 'cube' that defines all the levels of aggregation that we want to create. It is important to take note of the CROSS JOIN of the two derived tables. This generates all the levels for us. The rest of the code is really there for formatting.
86
+
Take note of the CROSS JOIN of the two derived tables since this generates all the levels for us. The rest of the code is there for formatting:
87
87
88
88
```sql
89
89
CREATE TABLE #Cube
@@ -114,7 +114,7 @@ SELECT Cols
114
114
FROM GrpCube;
115
115
```
116
116
117
-
The following shows the results of the CTAS:
117
+
The following image shows the results of the CTAS:
118
118
119
119

120
120
@@ -141,7 +141,7 @@ WITH
141
141
;
142
142
```
143
143
144
-
The third step is to loop over our cube of columns performing the aggregation. The query will run once for every row in the #Cube temporary table and store the results in the #Results temp table
144
+
The third step is to loop over our cube of columns performing the aggregation. The query will run once for every row in the #Cube temporary table. The results are stored in the #Results temp table:
145
145
146
146
```sql
147
147
SET @nbr =(SELECTMAX(Seq) FROM#Cube);
@@ -165,7 +165,7 @@ BEGIN
165
165
END
166
166
```
167
167
168
-
Lastly, you can return the results by simply reading from the #Results temporary table
168
+
Lastly, you can return the results by reading from the #Results temporary table:
169
169
170
170
```sql
171
171
SELECT*
@@ -174,7 +174,7 @@ ORDER BY 1,2,3
174
174
;
175
175
```
176
176
177
-
By breaking the code up into sections and generating a looping construct, the code becomes more manageable and maintainable.
177
+
By breaking up the code into sections and generating a looping construct, the code becomes more manageable and maintainable.
178
178
179
179
## Next steps
180
180
For more development tips, see [development overview](sql-data-warehouse-overview-develop.md).
The last line tags the string 'My Query Label' to the query. This tag is particularly helpful since the label is query-able through the DMVs. Querying for labels provides a mechanism for locating problem queries and helping to identify progress through an ELT run.
30
+
The last line tags the string 'My Query Label' to the query. This tag is helpful because the label is query-able through the DMVs.
31
31
32
-
A good naming convention really helps. For example, starting the label with PROJECT, PROCEDURE, STATEMENT, or COMMENT helps to uniquely identify the query among all the code in source control.
32
+
Querying for labels provides a mechanism for locating problem queries and helping to identify progress through an ELT run.
33
33
34
-
The following query uses a dynamic management view to search by label.
34
+
A good naming convention really helps. For example, starting the label with PROJECT, PROCEDURE, STATEMENT, or COMMENT uniquely identifies the query among all the code in source control.
35
+
36
+
The following query uses a dynamic management view to search by label:
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-develop-loops.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Using T-SQL loops
3
-
description: Tips for using T-SQL loops and replacing cursors in Azure SQL Data Warehouse for developing solutions.
3
+
description: Tips for solution development using T-SQL loops and replacing cursors in Synapse SQL pool.
4
4
services: synapse-analytics
5
5
author: XiaoyuMSFT
6
6
manager: craigg
@@ -13,17 +13,21 @@ ms.reviewer: igorstan
13
13
ms.custom: seo-lt-2019
14
14
---
15
15
16
-
# Using T-SQL loops in SQL Data Warehouse
17
-
Tips for using T-SQL loops and replacing cursors in Azure SQL Data Warehouse for developing solutions.
16
+
# Using T-SQL loops in Synapse SQL pool
17
+
Included in this article are tips for SQL pool solution development using T-SQL loops and replacing cursors.
18
18
19
19
## Purpose of WHILE loops
20
20
21
-
SQL Data Warehouse supports the [WHILE](/sql/t-sql/language-elements/while-transact-sql) loop for repeatedly executing statement blocks. This WHILE loop continues for as long as the specified conditions are true or until the code specifically terminates the loop using the BREAK keyword. Loops are useful for replacing cursors defined in SQL code. Fortunately, almost all cursors that are written in SQL code are of the fast forward, read-only variety. Therefore, [WHILE] loops are a great alternative for replacing cursors.
21
+
Synapse SQL pool supports the [WHILE](https://docs.microsoft.com/sql/t-sql/language-elements/while-transact-sql?view=sql-server-ver15) loop for repeatedly executing statement blocks. This WHILE loop continues for as long as the specified conditions are true or until the code specifically terminates the loop using the BREAK keyword.
22
22
23
-
## Replacing cursors in SQL Data Warehouse
24
-
However, before diving in head first you should ask yourself the following question: "Could this cursor be rewritten to use set-based operations?." In many cases, the answer is yes and is often the best approach. A set-based operation often performs faster than an iterative, row by row approach.
23
+
Loops are useful for replacing cursors defined in SQL code. Fortunately, almost all cursors that are written in SQL code are of the fast forward, read-only variety. So, WHILE loops are a great alternative for replacing cursors.
25
24
26
-
Fast forward read-only cursors can be easily replaced with a looping construct. The following is a simple example. This code example updates the statistics for every table in the database. By iterating over the tables in the loop, each command executes in sequence.
25
+
## Replacing cursors in Synapse SQL pool
26
+
However, before diving in head first you should ask yourself the following question: "Could this cursor be rewritten to use set-based operations?"
27
+
28
+
In many cases, the answer is yes and is frequently the best approach. A set-based operation often performs faster than an iterative, row by row approach.
29
+
30
+
Fast forward read-only cursors can be easily replaced with a looping construct. The following example is a simple one. This code example updates the statistics for every table in the database. By iterating over the tables in the loop, each command executes in sequence.
27
31
28
32
First, create a temporary table containing a unique row number used to identify the individual statements:
0 commit comments