Skip to content

Commit 7562f27

Browse files
authored
Merge pull request #111932 from MightyPen/mar14az5
Add colorizer 'syntaxsql' in articles under 'articles/sql-database/'.
2 parents 47482d0 + e4193d6 commit 7562f27

6 files changed

+115
-139
lines changed

articles/sql-database/elastic-jobs-tsql.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ Adds a new job.
429429
#### Syntax
430430

431431

432-
```sql
432+
```syntaxsql
433433
[jobs].sp_add_job [ @job_name = ] 'job_name'
434434
[ , [ @description = ] 'description' ]
435435
[ , [ @enabled = ] enabled ]
@@ -494,7 +494,7 @@ Updates an existing job.
494494

495495
#### Syntax
496496

497-
```sql
497+
```syntaxsql
498498
[jobs].sp_update_job [ @job_name = ] 'job_name'
499499
[ , [ @new_name = ] 'new_name' ]
500500
[ , [ @description = ] 'description' ]
@@ -557,7 +557,7 @@ Deletes an existing job.
557557

558558
#### Syntax
559559

560-
```sql
560+
```syntaxsql
561561
[jobs].sp_delete_job [ @job_name = ] 'job_name'
562562
[ , [ @force = ] force ]
563563
```
@@ -590,7 +590,7 @@ Adds a step to a job.
590590
#### Syntax
591591

592592

593-
```sql
593+
```syntaxsql
594594
[jobs].sp_add_jobstep [ @job_name = ] 'job_name'
595595
[ , [ @step_id = ] step_id ]
596596
[ , [ @step_name = ] step_name ]
@@ -715,7 +715,7 @@ Updates a job step.
715715

716716
#### Syntax
717717

718-
```sql
718+
```syntaxsql
719719
[jobs].sp_update_jobstep [ @job_name = ] 'job_name'
720720
[ , [ @step_id = ] step_id ]
721721
[ , [ @step_name = ] 'step_name' ]
@@ -841,7 +841,7 @@ Removes a job step from a job.
841841
#### Syntax
842842

843843

844-
```sql
844+
```syntaxsql
845845
[jobs].sp_delete_jobstep [ @job_name = ] 'job_name'
846846
[ , [ @step_id = ] step_id ]
847847
[ , [ @step_name = ] 'step_name' ]
@@ -887,7 +887,7 @@ Starts executing a job.
887887
#### Syntax
888888

889889

890-
```sql
890+
```syntaxsql
891891
[jobs].sp_start_job [ @job_name = ] 'job_name'
892892
[ , [ @job_execution_id = ] job_execution_id OUTPUT ]
893893
```
@@ -918,7 +918,7 @@ Stops a job execution.
918918
#### Syntax
919919

920920

921-
```sql
921+
```syntaxsql
922922
[jobs].sp_stop_job [ @job_execution_id = ] ' job_execution_id '
923923
```
924924

@@ -947,7 +947,7 @@ Adds a target group.
947947
#### Syntax
948948

949949

950-
```sql
950+
```syntaxsql
951951
[jobs].sp_add_target_group [ @target_group_name = ] 'target_group_name'
952952
[ , [ @target_group_id = ] target_group_id OUTPUT ]
953953
```
@@ -979,7 +979,7 @@ Deletes a target group.
979979
#### Syntax
980980

981981

982-
```sql
982+
```syntaxsql
983983
[jobs].sp_delete_target_group [ @target_group_name = ] 'target_group_name'
984984
```
985985

@@ -1006,7 +1006,7 @@ Adds a database or group of databases to a target group.
10061006

10071007
#### Syntax
10081008

1009-
```sql
1009+
```syntaxsql
10101010
[jobs].sp_add_target_group_member [ @target_group_name = ] 'target_group_name'
10111011
[ @membership_type = ] 'membership_type' ]
10121012
[ , [ @target_type = ] 'target_type' ]
@@ -1097,7 +1097,7 @@ Removes a target group member from a target group.
10971097
#### Syntax
10981098

10991099

1100-
```sql
1100+
```syntaxsql
11011101
[jobs].sp_delete_target_group_member [ @target_group_name = ] 'target_group_name'
11021102
[ , [ @target_id = ] 'target_id']
11031103
```
@@ -1149,7 +1149,7 @@ Removes the history records for a job.
11491149
#### Syntax
11501150

11511151

1152-
```sql
1152+
```syntaxsql
11531153
[jobs].sp_purge_jobhistory [ @job_name = ] 'job_name'
11541154
[ , [ @job_id = ] job_id ]
11551155
[ , [ @oldest_date = ] oldest_date []

articles/sql-database/sql-database-json-features.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: conceptual
1010
author: jovanpop-msft
1111
ms.author: jovanpop
1212
ms.reviewer:
13-
ms.date: 01/15/2019
13+
ms.date: 04/19/2019
1414
---
1515
# Getting started with JSON features in Azure SQL Database
1616
Azure SQL Database lets you parse and query data represented in JavaScript Object Notation [(JSON)](https://www.json.org/) format, and export your relational data as JSON text. The following JSON scenarios are available in Azure SQL Database:
@@ -24,15 +24,15 @@ If you have a web service that takes data from the database layer and provides a
2424

2525
In the following example, rows from the Sales.Customer table are formatted as JSON by using the FOR JSON clause:
2626

27-
```
27+
```sql
2828
select CustomerName, PhoneNumber, FaxNumber
2929
from Sales.Customers
3030
FOR JSON PATH
3131
```
3232

3333
The FOR JSON PATH clause formats the results of the query as JSON text. Column names are used as keys, while the cell values are generated as JSON values:
3434

35-
```
35+
```json
3636
[
3737
{"CustomerName":"Eric Torres","PhoneNumber":"(307) 555-0100","FaxNumber":"(307) 555-0101"},
3838
{"CustomerName":"Cosmina Vlad","PhoneNumber":"(505) 555-0100","FaxNumber":"(505) 555-0101"},
@@ -44,7 +44,7 @@ The result set is formatted as a JSON array where each row is formatted as a sep
4444

4545
PATH indicates that you can customize the output format of your JSON result by using dot notation in column aliases. The following query changes the name of the "CustomerName" key in the output JSON format, and puts phone and fax numbers in the "Contact" sub-object:
4646

47-
```
47+
```sql
4848
select CustomerName as Name, PhoneNumber as [Contact.Phone], FaxNumber as [Contact.Fax]
4949
from Sales.Customers
5050
where CustomerID = 931
@@ -53,7 +53,7 @@ FOR JSON PATH, WITHOUT_ARRAY_WRAPPER
5353

5454
The output of this query looks like this:
5555

56-
```
56+
```json
5757
{
5858
"Name":"Nada Jovanovic",
5959
"Contact":{
@@ -67,20 +67,19 @@ In this example, we returned a single JSON object instead of an array by specify
6767

6868
The main value of the FOR JSON clause is that it lets you return complex hierarchical data from your database formatted as nested JSON objects or arrays. The following example shows how to include the rows from the `Orders` table that belong to the `Customer` as a nested array of `Orders`:
6969

70-
```
70+
```sql
7171
select CustomerName as Name, PhoneNumber as Phone, FaxNumber as Fax,
7272
Orders.OrderID, Orders.OrderDate, Orders.ExpectedDeliveryDate
7373
from Sales.Customers Customer
7474
join Sales.Orders Orders
7575
on Customer.CustomerID = Orders.CustomerID
7676
where Customer.CustomerID = 931
7777
FOR JSON AUTO, WITHOUT_ARRAY_WRAPPER
78-
7978
```
8079

8180
Instead of sending separate queries to get Customer data and then to fetch a list of related Orders, you can get all the necessary data with a single query, as shown in the following sample output:
8281

83-
```
82+
```json
8483
{
8584
"Name":"Nada Jovanovic",
8685
"Phone":"(215) 555-0100",
@@ -89,7 +88,7 @@ Instead of sending separate queries to get Customer data and then to fetch a lis
8988
{"OrderID":382,"OrderDate":"2013-01-07","ExpectedDeliveryDate":"2013-01-08"},
9089
{"OrderID":395,"OrderDate":"2013-01-07","ExpectedDeliveryDate":"2013-01-08"},
9190
{"OrderID":1657,"OrderDate":"2013-01-31","ExpectedDeliveryDate":"2013-02-01"}
92-
]
91+
]
9392
}
9493
```
9594

@@ -98,7 +97,7 @@ If you don’t have strictly structured data, if you have complex sub-objects, a
9897

9998
JSON is a textual format that can be used like any other string type in Azure SQL Database. You can send or store JSON data as a standard NVARCHAR:
10099

101-
```
100+
```sql
102101
CREATE TABLE Products (
103102
Id int identity primary key,
104103
Title nvarchar(200),
@@ -114,7 +113,7 @@ END
114113

115114
The JSON data used in this example is represented by using the NVARCHAR(MAX) type. JSON can be inserted into this table or provided as an argument of the stored procedure using standard Transact-SQL syntax as shown in the following example:
116115

117-
```
116+
```sql
118117
EXEC InsertProduct 'Toy car', '{"Price":50,"Color":"White","tags":["toy","children","games"]}'
119118
```
120119

@@ -125,7 +124,7 @@ If you have data formatted as JSON stored in Azure SQL tables, JSON functions le
125124

126125
JSON functions that are available in Azure SQL database let you treat data formatted as JSON as any other SQL data type. You can easily extract values from the JSON text, and use JSON data in any query:
127126

128-
```
127+
```sql
129128
select Id, Title, JSON_VALUE(Data, '$.Color'), JSON_QUERY(Data, '$.tags')
130129
from Products
131130
where JSON_VALUE(Data, '$.Color') = 'White'
@@ -143,7 +142,7 @@ The JSON_MODIFY function lets you specify the path of the value in the JSON text
143142

144143
Since JSON is stored in a standard text, there are no guarantees that the values stored in text columns are properly formatted. You can verify that text stored in JSON column is properly formatted by using standard Azure SQL Database check constraints and the ISJSON function:
145144

146-
```
145+
```sql
147146
ALTER TABLE Products
148147
ADD CONSTRAINT [Data should be formatted as JSON]
149148
CHECK (ISJSON(Data) > 0)
@@ -162,7 +161,7 @@ In the example above, we can specify where to locate the JSON array that should
162161

163162
We can transform a JSON array in the @orders variable into a set of rows, analyze this result set, or insert rows into a standard table:
164163

165-
```
164+
```sql
166165
CREATE PROCEDURE InsertOrders(@orders nvarchar(max))
167166
AS BEGIN
168167

@@ -175,9 +174,9 @@ AS BEGIN
175174
Customer varchar(200),
176175
Quantity int
177176
)
178-
179177
END
180178
```
179+
181180
The collection of orders formatted as a JSON array and provided as a parameter to the stored procedure can be parsed and inserted into the Orders table.
182181

183182
## Next steps

articles/sql-database/sql-database-managed-instance-long-term-backup-retention-configure.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ author: anosov1960
1111
ms.author: sashan
1212
ms.reviewer: mathoma, carlrab
1313
manager: craigg
14-
ms.date: 04/14/2020
14+
ms.date: 04/19/2020
1515
---
1616
# Manage Azure SQL Database managed instance long-term backup retention (PowerShell)
1717

@@ -30,24 +30,22 @@ For **Get-AzSqlInstanceDatabaseLongTermRetentionBackup** and **Restore-AzSqlInst
3030
- Subscription Owner role or
3131
- Managed Instance Contributor role or
3232
- Custom role with the following permissions:
33-
34-
```Microsoft.Sql/locations/longTermRetentionManagedInstanceBackups/read```
35-
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionManagedInstanceBackups/read```
36-
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/read```
33+
- `Microsoft.Sql/locations/longTermRetentionManagedInstanceBackups/read`
34+
- `Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionManagedInstanceBackups/read`
35+
- `Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/read`
3736

3837
For **Remove-AzSqlInstanceDatabaseLongTermRetentionBackup**, you will need to have one of the following roles:
3938

4039
- Subscription Owner role or
4140
- Custom role with the following permission:
42-
43-
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/delete```
41+
- `Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/delete`
4442

4543
> [!NOTE]
4644
> The Managed Instance Contributor role does not have permission to delete LTR backups.
4745
4846
RBAC permissions could be granted in either *subscription* or *resource group* scope. However, to access LTR backups that belong to a dropped instance, the permission must be granted in the *subscription* scope of that instance.
4947

50-
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/delete```
48+
- `Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/delete`
5149

5250
## Create an LTR policy
5351

@@ -70,7 +68,6 @@ Set-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceNa
7068
# create LTR policy with WeeklyRetention = 12 weeks, YearlyRetention = 5 years and WeekOfYear = 16 (week of April 15). MonthlyRetention = 0 by default.
7169
Set-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceName `
7270
-DatabaseName $dbName -ResourceGroupName $resourceGroup -WeeklyRetention P12W -YearlyRetention P5Y -WeekOfYear 16
73-
7471
```
7572

7673
## View LTR policies
@@ -81,7 +78,6 @@ This example shows how to list the LTR policies within an instance
8178
# gets the current version of LTR policy for the database
8279
$ltrPolicies = Get-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceName `
8380
-DatabaseName $dbName -ResourceGroupName $resourceGroup
84-
8581
```
8682

8783
## Clear an LTR policy
@@ -113,7 +109,6 @@ $ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instan
113109
114110
# only list the latest LTR backup for each database
115111
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location -InstanceName $instanceName -OnlyLatestPerDatabase
116-
117112
```
118113

119114
## Delete LTR backups
@@ -137,7 +132,6 @@ This example shows how to restore from an LTR backup. Note, this interface did n
137132
# restore a specific LTR backup as an P1 database on the instance $instanceName of the resource group $resourceGroup
138133
Restore-AzSqlInstanceDatabase -FromLongTermRetentionBackup -ResourceId $ltrBackup.ResourceId `
139134
-TargetInstanceName $instanceName -TargetResourceGroupName $resourceGroup -TargetInstanceDatabaseName $dbName
140-
141135
```
142136

143137
> [!IMPORTANT]

articles/sql-database/sql-database-monitoring-with-dmvs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: conceptual
1010
author: juliemsft
1111
ms.author: jrasnick
1212
ms.reviewer: carlrab
13-
ms.date: 03/10/2020
13+
ms.date: 04/19/2020
1414
---
1515
# Monitoring performance Azure SQL Database using dynamic management views
1616

@@ -598,7 +598,7 @@ The next example shows you different ways that you can use the **sys.resource_st
598598
599599
3. With this information about the average and maximum values of each resource metric, you can assess how well your workload fits into the compute size you chose. Usually, average values from **sys.resource_stats** give you a good baseline to use against the target size. It should be your primary measurement stick. For an example, you might be using the Standard service tier with S2 compute size. The average use percentages for CPU and IO reads and writes are below 40 percent, the average number of workers is below 50, and the average number of sessions is below 200. Your workload might fit into the S1 compute size. It's easy to see whether your database fits in the worker and session limits. To see whether a database fits into a lower compute size with regards to CPU, reads, and writes, divide the DTU number of the lower compute size by the DTU number of your current compute size, and then multiply the result by 100:
600600

601-
```S1 DTU / S2 DTU * 100 = 20 / 50 * 100 = 40```
601+
`S1 DTU / S2 DTU * 100 = 20 / 50 * 100 = 40`
602602

603603
The result is the relative performance difference between the two compute sizes in percentage. If your resource use doesn't exceed this amount, your workload might fit into the lower compute size. However, you need to look at all ranges of resource use values, and determine, by percentage, how often your database workload would fit into the lower compute size. The following query outputs the fit percentage per resource dimension, based on the threshold of 40 percent that we calculated in this example:
604604

articles/sql-database/sql-database-single-database-get-started.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: quickstart
1010
author: sachinpMSFT
1111
ms.author: ninarn
1212
ms.reviewer: carlrab, sstein, vanto
13-
ms.date: 03/10/2020
13+
ms.date: 04/19/2020
1414
---
1515
# Quickstart: Create an Azure SQL Database single database
1616

@@ -61,31 +61,32 @@ Keep the resource group, server, and single database to go on to the next steps,
6161

6262
When you're finished using these resources, you can delete the resource group you created, which will also delete the server and single database within it.
6363

64-
# [Portal](#tab/azure-portal)
64+
### [Portal](#tab/azure-portal)
6565

6666
To delete **myResourceGroup** and all its resources using the Azure portal:
6767

6868
1. In the portal, search for and select **Resource groups**, and then select **myResourceGroup** from the list.
6969
1. On the resource group page, select **Delete resource group**.
7070
1. Under **Type the resource group name**, enter *myResourceGroup*, and then select **Delete**.
7171

72-
# [Azure CLI](#tab/azure-cli)
72+
### [Azure CLI](#tab/azure-cli)
7373

7474
To delete the resource group and all its resources, run the following Azure CLI command, using the name of your resource group:
7575

7676
```azurecli-interactive
7777
az group delete --name <your resource group>
7878
```
7979

80-
# [PowerShell](#tab/azure-powershell)
80+
### [PowerShell](#tab/azure-powershell)
8181

8282
To delete the resource group and all its resources, run the following PowerShell cmdlet, using the name of your resource group:
8383

84-
```azurepowershell-interactive
84+
```azurepowershell-interactive
8585
Remove-AzResourceGroup -Name <your resource group>
8686
```
8787

8888
---
89+
8990
## Next steps
9091

9192
[Connect and query](sql-database-connect-query.md) your database using different tools and languages:

0 commit comments

Comments
 (0)