Skip to content

Commit d70957f

Browse files
Add GO (batch delimiters) where needed
1 parent 6559345 commit d70957f

9 files changed

Lines changed: 39 additions & 38 deletions

docs/relational-databases/security/row-level-security.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ Create a sample schema and a fact table to hold data.
554554

555555
```sql
556556
CREATE SCHEMA Sample;
557-
557+
GO
558558
CREATE TABLE Sample.Sales
559559
(
560560
OrderID int,
@@ -606,7 +606,7 @@ Create a new schema, and an inline table-valued function. The function returns 1
606606

607607
```sql
608608
CREATE SCHEMA Security ;
609-
609+
GO
610610
CREATE FUNCTION Security.fn_securitypredicate
611611
(@Product AS varchar(10))
612612
RETURNS TABLE

docs/relational-databases/tables/manage-retention-of-historical-data-in-system-versioned-temporal-tables.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,27 @@ To maintain a sliding window, you need to make predicate function to be accurate
130130

131131
```sql
132132
BEGIN TRAN
133+
GO
133134
/*(1) Create new predicate function definition */
134-
CREATE FUNCTION dbo.fn_StretchBySystemEndTime20151102(@systemEndTime datetime2)
135-
RETURNS TABLE
136-
WITH SCHEMABINDING
137-
AS
138-
RETURN SELECT 1 AS is_eligible
139-
WHERE @systemEndTime < CONVERT(datetime2,'2015-11-02T00:00:00', 101)
140-
GO
135+
CREATE FUNCTION dbo.fn_StretchBySystemEndTime20151102(@systemEndTime datetime2)
136+
RETURNS TABLE
137+
WITH SCHEMABINDING
138+
AS
139+
RETURN SELECT 1 AS is_eligible
140+
WHERE @systemEndTime < CONVERT(datetime2,'2015-11-02T00:00:00', 101)
141+
GO
141142

142143
/*(2) Set the new function as filter predicate */
143-
ALTER TABLE <history table name>
144-
SET
145-
(
146-
REMOTE_DATA_ARCHIVE = ON
147-
(
148-
FILTER_PREDICATE = dbo.fn_StretchBySystemEndTime20151102(SysEndTime),
149-
MIGRATION_STATE = OUTBOUND
150-
)
151-
)
144+
ALTER TABLE [<history table name>]
145+
SET
146+
(
147+
REMOTE_DATA_ARCHIVE = ON
148+
(
149+
FILTER_PREDICATE = dbo.fn_StretchBySystemEndTime20151102(SysEndTime),
150+
MIGRATION_STATE = OUTBOUND
151+
)
152+
)
153+
GO
152154
COMMIT ;
153155
```
154156

docs/sql-server/stretch-database/select-rows-to-migrate-by-using-a-filter-function-stretch-database.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ ms.custom: seo-dt-2019
3838
The inline table-valued function required for a Stretch Database filter predicate looks like the following example.
3939

4040
```sql
41-
CREATE FUNCTION dbo.fn_stretchpredicate(@column1 datatype1, @column2 datatype2 [, ...n])
41+
CREATE FUNCTION dbo.fn_stretchpredicate(@column1 datatype1, @column2 datatype2 /*[, ...n]*/)
4242
RETURNS TABLE
4343
WITH SCHEMABINDING
4444
AS
4545
RETURN SELECT 1 AS is_eligible
46-
WHERE <predicate>
46+
WHERE someCol = @column1 /* replace with an actual predicate */
4747
```
4848

4949
The parameters for the function have to be identifiers for columns from the table.

docs/t-sql/functions/odbc-scalar-functions-transact-sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ DECLARE @len INT
129129
SET @len = (SELECT {fn OCTET_LENGTH( @string_exp )})
130130
RETURN(@len)
131131
END ;
132-
132+
GO
133133
SELECT dbo.ODBCudf('Returns the length.');
134134
--Returns 38
135135
```
@@ -203,7 +203,7 @@ DECLARE @len INT
203203
SET @len = (SELECT {fn BIT_LENGTH( @string_exp )})
204204
RETURN(@len)
205205
END ;
206-
206+
GO
207207
SELECT dbo.ODBCudf('Returns the length in bits.');
208208
--Returns 432
209209
```

docs/t-sql/queries/option-clause-transact-sql.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-s
3737
### Syntax for [!INCLUDE[ssnoversion-md.md](../../includes/ssnoversion-md.md)] and [!INCLUDE[ssazure_md.md](../../includes/ssazure_md.md)].
3838

3939
```syntaxsql
40-
4140
[ OPTION ( <query_hint> [ ,...n ] ) ]
4241
```
4342

4443
### Syntax for [!INCLUDE[sssdw-md.md](../../includes/sssdw-md.md)] and [!INCLUDE[sspdw-md.md](../../includes/sspdw-md.md)]
4544

4645
```syntaxsql
47-
4846
OPTION ( <query_option> [ ,...n ] )
4947
5048
<query_option> ::=
@@ -62,7 +60,6 @@ OPTION ( <query_option> [ ,...n ] )
6260
### Syntax for [!INCLUDE[sssodfull-md.md](../../includes/sssodfull-md.md)]
6361

6462
```syntaxsql
65-
6663
OPTION ( <query_option> [ ,...n ] )
6764
6865
<query_option> ::=
@@ -132,29 +129,29 @@ OPTION ( Label = 'CustJoin', HASH JOIN, MERGE JOIN);
132129
The following example creates a view named CustomerView and then uses a HASH JOIN query hint in a query that references a view and a table.
133130

134131
```sql
135-
-- Uses AdventureWorks
132+
-- Uses the AdventureWorks sample database
136133

137134
CREATE VIEW CustomerView
138135
AS
139136
SELECT CustomerKey, FirstName, LastName FROM ssawPDW..DimCustomer;
140-
137+
GO
141138
SELECT COUNT (*) FROM dbo.CustomerView a
142139
INNER JOIN dbo.FactInternetSales b
143140
ON (a.CustomerKey = b.CustomerKey)
144141
OPTION (HASH JOIN);
145-
142+
GO
146143
DROP VIEW CustomerView;
144+
GO
147145
```
148146

149147
### F. Query with a subselect and a query hint
150148
The following example shows a query that contains both a subselect and a query hint. The query hint is applied globally. Query hints are not allowed to be appended to the subselect statement.
151149

152150
```sql
153-
-- Uses AdventureWorks
154-
151+
-- Uses the AdventureWorks sample database
155152
CREATE VIEW CustomerView AS
156153
SELECT CustomerKey, FirstName, LastName FROM ssawPDW..DimCustomer;
157-
154+
GO
158155
SELECT * FROM (
159156
SELECT COUNT (*) AS a FROM dbo.CustomerView a
160157
INNER JOIN dbo.FactInternetSales b

docs/t-sql/statements/add-signature-transact-sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ CREATE USER Alice;
200200
EXECUTE AS LOGIN = 'Alice';
201201
SELECT * FROM T1;
202202
REVERT;
203-
203+
GO
204204
-- Create a procedure that directly accesses T1
205205
CREATE PROCEDURE procSelectT1 AS
206206
BEGIN
@@ -209,7 +209,7 @@ BEGIN
209209
END;
210210
GO
211211
GRANT EXECUTE ON ProcSelectT1 to public;
212-
212+
GO
213213
-- Create special procedure for accessing T1
214214
CREATE PROCEDURE ProcForAlice AS
215215
BEGIN

docs/t-sql/statements/create-materialized-view-as-select-transact-sql.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ A user needs following permissions to create a materialized view in addition to
161161
## Example
162162
A. This example shows how Synapse SQL optimizer automatically uses materialized views to execute a query for better performance even when the query uses functions un-supported in CREATE MATERIALIZED VIEW, such as COUNT(DISTINCT expression). A query used to take multiple seconds to complete now finishes in sub-second without any change in the user query.
163163

164-
``` sql
164+
```sql
165165

166166
-- Create a table with ~536 million rows
167167
create table t(a int not null, b int not null, c int not null) with (distribution=hash(a), clustered columnstore index);
@@ -212,7 +212,9 @@ SchemaY owner = User1
212212
*****************************************************************/
213213
CREATE USER User1 WITHOUT LOGIN ;
214214
CREATE USER User2 WITHOUT LOGIN ;
215-
CREATE SCHEMA SchemaX;
215+
GO
216+
CREATE SCHEMA SchemaX;
217+
GO
216218
CREATE SCHEMA SchemaY AUTHORIZATION User1;
217219
GO
218220
CREATE TABLE [SchemaX].[T1] ( [vendorID] [varchar](255) Not NULL, [totalAmount] [float] Not NULL, [puYear] [int] NULL );

docs/t-sql/statements/create-procedure-transact-sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ END CATCH;
854854

855855
GO
856856
EXEC Production.uspDeleteWorkOrder 13;
857-
857+
GO
858858
/* Intentionally generate an error by reversing the order in which rows
859859
are deleted from the parent and child tables. This change does not
860860
cause an error when the procedure definition is altered, but produces
@@ -888,7 +888,7 @@ END CATCH;
888888
GO
889889
-- Execute the altered procedure.
890890
EXEC Production.uspDeleteWorkOrder 15;
891-
891+
GO
892892
DROP PROCEDURE Production.uspDeleteWorkOrder;
893893
```
894894

docs/t-sql/statements/set-noexec-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ GO
7878
-- SET NOEXEC to ON.
7979
SET NOEXEC ON;
8080
GO
81-
-- Function name uses is a reserved keyword.
81+
-- Function name used is a reserved keyword.
8282
USE AdventureWorks2012;
8383
GO
8484
CREATE FUNCTION dbo.Values(@BusinessEntityID int)

0 commit comments

Comments
 (0)