Skip to content

Commit dac4a6a

Browse files
Fix minor syntax issues in SQL code examples
1 parent a23553a commit dac4a6a

6 files changed

Lines changed: 27 additions & 22 deletions

docs/database-engine/availability-groups/windows/automatic-seeding-secondary-replicas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ CREATE AVAILABILITY GROUP [<AGName>]
8888
WITH (
8989
ENDPOINT_URL = N'TCP://Primary_Replica.Contoso.com:5022',
9090
FAILOVER_MODE = AUTOMATIC,
91-
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
91+
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT
9292
),
9393
N'Secondary_Replica' WITH (
9494
ENDPOINT_URL = N'TCP://Secondary_Replica.Contoso.com:5022',

docs/database-engine/availability-groups/windows/change-the-availability-mode-of-an-availability-replica-sql-server.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ You must be connected to the server instance that hosts the primary replica.
4848
2. Use the [ALTER AVAILABILITY GROUP](../../../t-sql/statements/alter-availability-group-transact-sql.md) statement, as the following example:
4949

5050
```sql
51-
ALTER AVAILABILITY GROUP *group_name* MODIFY REPLICA ON '*server_name*'
52-
WITH ( AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT , FAILOVER_MODE = MANUAL );
51+
ALTER AVAILABILITY GROUP [<availability_group_name>] MODIFY REPLICA ON '*server_name*'
52+
WITH ( AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT)
53+
54+
ALTER AVAILABILITY GROUP [<availability_group_name>] MODIFY REPLICA ON '*server_name*'
55+
WITH ( FAILOVER_MODE = MANUAL );
5356
```
5457

5558
Where *group_name* is the name of the availability group and *server_name* is the name of the server instance that hosts the replica to be modified.

docs/database-engine/availability-groups/windows/create-an-availability-group-transact-sql.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ ms.author: chadam
226226

227227
The following code example creates a transaction log backup on MyDb1 and on MyDb2.
228228

229-
```sql
229+
```sql
230230
-- On the server instance that hosts the primary replica,
231231
-- Backup the transaction log on each primary database:
232232
BACKUP LOG MyDb1
@@ -236,7 +236,7 @@ ms.author: chadam
236236
237237
BACKUP LOG MyDb2
238238
TO DISK = N'\\FILESERVER\SQLbackups\MyDb2.bak'
239-
WITHNOFORMAT;
239+
WITH NOFORMAT;
240240
GO
241241
```
242242

@@ -409,7 +409,7 @@ GO
409409
410410
BACKUP LOG MyDb2
411411
TO DISK = N'\\FILESERVER\SQLbackups\MyDb2.bak'
412-
WITHNOFORMAT
412+
WITH NOFORMAT
413413
GO
414414
415415
-- Restore the transaction log on each secondary database,

docs/database-engine/availability-groups/windows/secondary-replica-connection-redirection-always-on-availability-groups.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ The following transact-SQL script creates this AG. In this example, Each replica
9090
CREATE AVAILABILITY GROUP MyAg
9191
WITH ( CLUSTER_TYPE = NONE )
9292
FOR
93-
DATABASE <Database1>
93+
DATABASE [<Database1>]
9494
REPLICA ON
9595
'COMPUTER01' WITH
9696
(
@@ -100,8 +100,8 @@ CREATE AVAILABILITY GROUP MyAg
100100
SECONDARY_ROLE (ALLOW_CONNECTIONS = ALL,
101101
READ_ONLY_ROUTING_URL = 'TCP://COMPUTER01.<domain>.<tld>:1433' ),
102102
PRIMARY_ROLE (ALLOW_CONNECTIONS = READ_WRITE,
103-
READ_ONLY_ROUTING_LIST = (COMPUTER02, COMPUTER03),
104-
READ_WRITE_ROUTING_URL = 'TCP://COMPUTER01.<domain>.<tld>:1433' )
103+
READ_ONLY_ROUTING_LIST = ('COMPUTER02', 'COMPUTER03'),
104+
READ_WRITE_ROUTING_URL = 'TCP://COMPUTER01.<domain>.<tld>:1433' ),
105105
SESSION_TIMEOUT = 10
106106
),
107107
'COMPUTER02' WITH
@@ -112,8 +112,8 @@ CREATE AVAILABILITY GROUP MyAg
112112
SECONDARY_ROLE (ALLOW_CONNECTIONS = ALL,
113113
READ_ONLY_ROUTING_URL = 'TCP://COMPUTER02.<domain>.<tld>:1433' ),
114114
PRIMARY_ROLE (ALLOW_CONNECTIONS = READ_WRITE,
115-
READ_ONLY_ROUTING_LIST = (COMPUTER01, COMPUTER03),
116-
READ_WRITE_ROUTING_URL = 'TCP://COMPUTER02.<domain>.<tld>:1433' )
115+
READ_ONLY_ROUTING_LIST = ('COMPUTER01', 'COMPUTER03'),
116+
READ_WRITE_ROUTING_URL = 'TCP://COMPUTER02.<domain>.<tld>:1433' ),
117117
SESSION_TIMEOUT = 10
118118
),
119119
'COMPUTER03' WITH
@@ -124,8 +124,8 @@ CREATE AVAILABILITY GROUP MyAg
124124
SECONDARY_ROLE (ALLOW_CONNECTIONS = ALL,
125125
READ_ONLY_ROUTING_URL = 'TCP://COMPUTER03.<domain>.<tld>:1433' ),
126126
PRIMARY_ROLE (ALLOW_CONNECTIONS = READ_WRITE,
127-
READ_ONLY_ROUTING_LIST = (COMPUTER01, COMPUTER02),
128-
READ_WRITE_ROUTING_URL = 'TCP://COMPUTER03.<domain>.<tld>:1433' )
127+
READ_ONLY_ROUTING_LIST = ('COMPUTER01', 'COMPUTER02'),
128+
READ_WRITE_ROUTING_URL = 'TCP://COMPUTER03.<domain>.<tld>:1433' ),
129129
SESSION_TIMEOUT = 10
130130
);
131131
GO

docs/relational-databases/indexes/columnstore-indexes-data-loading-guidance.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ If you are loading data only to stage it before running more transformations, lo
7979
A common pattern for data load is to load the data into a staging table, do some transformation and then load it into the target table using the following command
8080

8181
```sql
82-
INSERT INTO <columnstore index>
83-
SELECT <list of columns> FROM <Staging Table>
82+
INSERT INTO [<columnstore index>]
83+
SELECT col1 /* include actual list of columns in place of col1*/
84+
FROM [<Staging Table>]
8485
```
8586

8687
This command loads the data into the columnstore index in similar ways to BCP or Bulk Insert but in a single batch. If the number of rows in the staging table < 102400, the rows are loaded into a delta rowgroup otherwise the rows are directly loaded into compressed rowgroup. One key limitation was that this `INSERT` operation was single threaded. To load data in parallel, you could create multiple staging table or issue `INSERT`/`SELECT` with non-overlapping ranges of rows from the staging table. This limitation goes away with [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)]. The command below loads the data from staging table in parallel but you will need to specify `TABLOCK`. You may find this contradictory to what was said earlier with bulkload but the key difference is the parallel data load from the staging table is executed under the same transaction.
8788

8889
```sql
89-
INSERT INTO <columnstore index> WITH (TABLOCK)
90-
SELECT <list of columns> FROM <Staging Table>
90+
INSERT INTO [<columnstore index>] WITH (TABLOCK)
91+
SELECT col1 /* include actual list of columns in place of col1*/
92+
FROM [<Staging Table>]
9193
```
9294

9395
There are following optimizations available when loading into clustered columnstore index from staging table:
@@ -101,7 +103,7 @@ SELECT <list of columns> FROM <Staging Table>
101103
*Trickle insert* refers to the way individual rows move into the columnstore index. Trickle inserts use the [INSERT INTO](../../t-sql/statements/insert-transact-sql.md) statement. With trickle insert, all of the rows go to the deltastore. This is useful for small numbers of rows, but not practical for large loads.
102104

103105
```sql
104-
INSERT INTO <table-name> VALUES (<set of values>)
106+
INSERT INTO [<table-name>] VALUES ('some value' /*replace with actual set of values*/)
105107
```
106108

107109
> [!NOTE]
@@ -110,13 +112,13 @@ INSERT INTO <table-name> VALUES (<set of values>)
110112
Once the rowgroup contains 1,048,576 rows, the delta rowgroup us marked closed but it is still available for queries and update/delete operations but the newly inserted rows go into an existing or newly created deltastore rowgroup. There is a background thread *Tuple Mover (TM)* that compresses the closed delta rowgroups periodically every 5 minutes or so. You can explicitly invoke the following command to compress the closed delta rowgroup
111113

112114
```sql
113-
ALTER INDEX <index-name> on <table-name> REORGANIZE
115+
ALTER INDEX [<index-name>] on [<table-name>] REORGANIZE
114116
```
115117

116118
If you want force a delta rowgroup closed and compressed, you can execute the following command. You may want run this command if you are done loading the rows and don't expect any new rows. By explicitly closing and compressing the delta rowgroup, you can save storage further and improve the analytics query performance. A best practice is to invoke this command if you don't expect new rows to be inserted.
117119

118120
```sql
119-
ALTER INDEX <index-name> on <table-name> REORGANIZE with (COMPRESS_ALL_ROW_GROUPS = ON)
121+
ALTER INDEX [<index-name>] on [<table-name>] REORGANIZE with (COMPRESS_ALL_ROW_GROUPS = ON)
120122
```
121123

122124
## How loading into a partitioned table works

docs/t-sql/data-types/parse-database-engine.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Parse converts the canonical string representation of a **hierarchyid** to a **h
2626

2727
## Syntax
2828

29-
```sql
29+
```syntaxsql
3030
-- Transact-SQL syntax
3131
hierarchyid::Parse ( input )
3232
-- This is functionally equivalent to the following syntax
@@ -72,7 +72,7 @@ GO
7272

7373
[!INCLUDE[ssResult](../../includes/ssresult-md.md)]
7474

75-
```
75+
```txt
7676
hierarchyidRepresentation StringRepresentation
7777
------------------------- -----------------------
7878
0x5ADE /1/1/3/

0 commit comments

Comments
 (0)