Skip to content

Commit 89fca34

Browse files
committed
Fix some boolean expression syntax issues
1 parent 0b00cf8 commit 89fca34

5 files changed

Lines changed: 14 additions & 15 deletions

File tree

‎docs/database-engine/availability-groups/windows/configure-backup-on-availability-replicas-sql-server.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ ms.author: chadam
160160
To take the automated backup preference into account for a given availability group, on each server instance that hosts an availability replica whose backup priority is greater than zero (>0), you need to script backup jobs for the databases in the availability group. To determine whether the current replica is the preferred backup replica, use the [sys.fn_hadr_backup_is_preferred_replica](../../../relational-databases/system-functions/sys-fn-hadr-backup-is-preferred-replica-transact-sql.md) function in your backup script. If the availability replica that is hosted by the current server instance is the preferred replica for backups, this function returns 1. If not, the function returns 0. By running a simple script on each availability replica that queries this function, you can determine which replica should run a given backup job. For example, a typical snippet of a backup-job script would look like:
161161
162162
```sql
163-
IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME))
163+
IF (sys.fn_hadr_backup_is_preferred_replica(@DBNAME) != 1)
164164
BEGIN
165165
Select 'This is not the preferred replica, exiting with success';
166166
RETURN 0 -- This is a normal, expected condition, so the script returns success
167167
END
168-
BACKUP DATABASE @DBNAME TO DISK=<disk>
168+
BACKUP DATABASE @DBNAME TO DISK = '<path to backup file>'
169169
WITH COPY_ONLY;
170170
```
171171

‎docs/relational-databases/system-functions/sys-fn-hadr-backup-is-preferred-replica-transact-sql.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ ms.author: mikeray
3232

3333
## Syntax
3434

35-
```
36-
35+
```syntaxsql
3736
sys.fn_hadr_backup_is_preferred_replica ( 'dbname' )
3837
```
3938

@@ -47,21 +46,22 @@ sys.fn_hadr_backup_is_preferred_replica ( 'dbname' )
4746
## Remarks
4847
Use this function in a backup script to determine if the current database is on the replica that is preferred for backups. You can run a script on every availability replica. Each of these jobs looks at the same data to determine which job should run, so only one of the scheduled jobs actually proceeds to the backup stage. Sample code could be similar to the following.
4948

50-
```
49+
```sql
5150
If sys.fn_hadr_backup_is_preferred_replica( @dbname ) <> 1
5251
BEGIN
53-
-- If this is not the preferred replica, exit (probably without error).
52+
-- If this is not the preferred replica, exit (probably without error).
53+
Select 'This is not the preferred replica, exiting with success';
5454
END
5555
-- If this is the preferred replica, continue to do the backup.
56-
56+
/* actual backup command goes here */
5757
```
5858

5959
## Examples
6060

6161
### A. Using sys.fn_hadr_backup_is_preferred_replica
6262
The following example returns 1 if the current database is the preferred backup replica.
6363

64-
```
64+
```sql
6565
SELECT sys.fn_hadr_backup_is_preferred_replica ('TestDB');
6666
GO
6767
```

‎docs/relational-databases/xml/auto-mode-heuristics-in-shaping-returned-xml.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ AUTO mode determines the shape of returned XML based on the query. In determinin
2626
```sql
2727
SELECT T1.Id, T2.Id, T1.Name
2828
FROM T1, T2
29-
WHERE ...
29+
WHERE Col1 = 1 /* actual predicate goes here*/
3030
ORDER BY T1.Id
3131
FOR XML AUTO;
3232
```
3333

3434
To determine where a new <`T1`> element starts, all column values of T1, except **ntext**, **text**, **image** and **xml**, are compared if the key on the table T1 is not specified. Next, assume that the **Name** column is **nvarchar(40)** and the SELECT statement returns this rowset:
3535

36-
```
36+
```txt
3737
T1.Id T1.Name T2.Id
3838
-----------------------
3939
1 Andrew 2

‎docs/t-sql/language-elements/expressions-transact-sql.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,16 @@ DELETE FROM dbo.MyTable
133133
WHERE
134134
(c1 = '0000001' AND c2 = 'A000001') or
135135
(c1 = '0000002' AND c2 = 'A000002') or
136-
(c1 = '0000003' AND c2 = 'A000003') or
137-
...
138-
136+
(c1 = '0000003' AND c2 = 'A000003')
137+
/* ... additional, similar expressions omitted for simplicity */
139138
```
140139
Change this query to:
141140

142141
```sql
143142
DELETE FROM dbo.MyTable WHERE (c1 = '0000001' AND c2 = 'A000001');
144143
DELETE FROM dbo.MyTable WHERE (c1 = '0000002' AND c2 = 'A000002');
145144
DELETE FROM dbo.MyTable WHERE (c1 = '0000003' AND c2 = 'A000003');
146-
...
145+
/* ... refactored, individual DELETE statements omitted for simplicity */
147146
```
148147

149148
## See Also

‎docs/t-sql/statements/create-external-table-transact-sql.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ The data files for an external table are stored in Hadoop or Azure blob storage.
12771277
12781278
```sql
12791279
SELECT cs.user_ip FROM ClickStream cs
1280-
JOIN User u ON cs.user_ip = u.user_ip
1280+
JOIN [User] u ON cs.user_ip = u.user_ip
12811281
WHERE cs.url = 'www.microsoft.com'
12821282
;
12831283
```

0 commit comments

Comments
 (0)