Skip to content

Commit e0fc2f6

Browse files
authored
Merge pull request MicrosoftDocs#6471 from MicrosoftDocs/FromPublicRepo
Confirm merge from FromPublicRepo to master to sync with https://github.com/MicrosoftDocs/sql-docs (branch live)
2 parents 69c569b + ffc2886 commit e0fc2f6

14 files changed

Lines changed: 68 additions & 65 deletions

docs/relational-databases/system-catalog-views/sys-event-log-azure-sql-database.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
title: "sys.event_log (Azure SQL Database) | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "06/10/2016"
@@ -131,7 +131,7 @@ start_time end_time
131131

132132
```
133133
SELECT * FROM sys.event_log
134-
WHERE start_time >= '2011-09-25:12:00:00'
134+
WHERE start_time >= '2011-09-25 12:00:00'
135135
AND end_time <= '2011-09-28 12:00:00';
136136
```
137137

docs/relational-databases/tables/create-primary-keys.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ monikerRange: "= azuresqldb-current || >= sql-server-2016 || = sqlallproducts-al
105105
3. Copy and paste the following example into the query window and click **Execute**. The example creates a table and defines a primary key on the column `CustomerID` and a clustered index on `TransactionID`.
106106

107107
```sql
108+
-- Select appropriate database
108109
USE AdventureWorks2012;
109110
GO
111+
-- Create table to add the clustered index
110112
CREATE TABLE Production.TransactionHistoryArchive1
111113
(
112114
CustomerID uniqueidentifier DEFAULT NEWSEQUENTIALID(),

docs/t-sql/functions/eventdata-transact-sql.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ manager: craigg
3232
# EVENTDATA (Transact-SQL)
3333
[!INCLUDE[tsql-appliesto-ss2008-asdb-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-asdb-xxxx-xxx-md.md)]
3434

35-
Returns information about server or database events. EVENTDATA is called when an event notification fires, and the results are returned to the specified service broker. EVENTDATA can also be used inside the body of a DDL or logon trigger.
35+
This function returns information about server or database events. When an event notification fires, and the specified service broker receives the results, `EVENTDATA` is called. A DDL or logon trigger also support internal use of `EVENTDATA`.
3636

3737
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3838

@@ -44,12 +44,17 @@ EVENTDATA( )
4444
```
4545

4646
## Remarks
47-
EVENTDATA returns data only when referenced directly inside of a DDL or logon trigger. EVENTDATA returns null if it is called by other routines, even if those routines are called by a DDL or logon trigger.
47+
`EVENTDATA` returns data only when referenced directly inside of a DDL or logon trigger. `EVENTDATA` returns null if other routines call it, even if a DDL or logon trigger calls those routines.
4848

49-
Data returned by EVENTDATA is not valid after a transaction that called EVENTDATA, either implicitly or explicitly, commits or is rolled back.
49+
Data returned by `EVENTDATA` is invalid after a transaction that
50+
51+
+ called `EVENTDATA` explicitly
52+
+ called `EVENTDATA` implicitly
53+
+ commits
54+
+ is rolled back
5055

5156
> [!CAUTION]
52-
> EVENTDATA returns XML data. This data is sent to the client as Unicode that uses 2 bytes for each character. The following Unicode code points can be represented in the XML that is returned by EVENTDATA:
57+
> `EVENTDATA` returns XML data, sent to the client as Unicode that uses 2 bytes for each character. `EVENTDATA` returns XML that can represent these Unicode code points:
5358
>
5459
> `0x0009`
5560
>
@@ -61,24 +66,24 @@ EVENTDATA( )
6166
>
6267
> `>= 0xE000 && <= 0xFFFD`
6368
>
64-
> Some characters that can appear in [!INCLUDE[tsql](../../includes/tsql-md.md)] identifiers and data are not expressible or permissible in XML. Characters or data that have code points not shown in the previous list are mapped to a question mark (?).
69+
> XML cannot express, and will not permit, some characters that can appear in [!INCLUDE[tsql](../../includes/tsql-md.md)] identifiers and data. Characters or data that have code points not shown in the previous list are mapped to a question mark (?).
6570
66-
To protect the security of logins, when CREATE LOGIN or ALTER LOGIN statements are executed, passwords are not displayed.
71+
Passwords do not display when `CREATE LOGIN` or `ALTER LOGIN` statements execute. This protects login security.
6772

6873
## Schemas Returned
69-
EVENTDATA returns a value of type **xml**. By default, the schema definition for all events is installed in the following directory: [!INCLUDE[ssInstallPath](../../includes/ssinstallpath-md.md)]Tools\Binn\schemas\sqlserver\2006\11\events\events.xsd.
74+
EVENTDATA returns a value of data type **xml**. By default, the schema definition for all events installs in this directory: [!INCLUDE[ssInstallPath](../../includes/ssinstallpath-md.md)]Tools\Binn\schemas\sqlserver\2006\11\events\events.xsd.
7075

71-
Alternatively, the event schema is published at the [Microsoft SQL Server XML Schemas](http://go.microsoft.com/fwlink/?LinkID=31850) Web page.
76+
The [Microsoft SQL Server XML Schemas](http://go.microsoft.com/fwlink/?LinkID=31850) web page also has the event schema.
7277

73-
To extract the schema for any particular event, search the schema for the Complex Type `EVENT_INSTANCE_\<event_type>`. For example, to extract the schema for the DROP_TABLE event, search the schema for `EVENT_INSTANCE_DROP_TABLE`.
78+
To extract the schema for any particular event, search the schema for the Complex Type `EVENT_INSTANCE_<event_type>`. For example, to extract the schema for the `DROP_TABLE` event, search the schema for `EVENT_INSTANCE_DROP_TABLE`.
7479

7580
## Examples
7681

7782
### A. Querying event data in a DDL trigger
78-
The following example creates a DDL trigger to prevent new tables from being created in the database. The [!INCLUDE[tsql](../../includes/tsql-md.md)] statement that fires the trigger is captured by using XQuery against the XML data that is generated by EVENTDATA. For more information, see [XQuery Language Reference &#40;SQL Server&#41;](../../xquery/xquery-language-reference-sql-server.md).
83+
This example creates a DDL trigger that prevents creation of new database tables. Use of XQuery against the XML data generated by `EVENTDATA` captures the [!INCLUDE[tsql](../../includes/tsql-md.md)] statement that fires the trigger. See [XQuery Language Reference &#40;SQL Server&#41;](../../xquery/xquery-language-reference-sql-server.md) for more information.
7984

8085
> [!NOTE]
81-
> When you query the `\<TSQLCommand>` element by using **Results to Grid** in [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], line breaks in the command text do not appear. Use **Results to Text** instead.
86+
> When using **Results to Grid** in [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] to query the `<TSQLCommand>` element, line breaks in the command text do not appear. Use **Results to Text** instead.
8287
8388
```
8489
USE AdventureWorks2012;
@@ -104,10 +109,10 @@ GO
104109
```
105110

106111
> [!NOTE]
107-
> When you want to return event data, we recommend that you use the XQuery **value()** method instead of the **query()** method. The **query()** method returns XML and ampersand-escaped carriage return and line feed (CR/LF) instances in the output, while the **value()** method renders CR/LF instances invisible in the output.
112+
> To return event data, use the XQuery **value()** method instead of the **query()** method. The **query()** method returns XML and ampersand-escaped carriage return and line feed (CR/LF) instances in the output, while the **value()** method renders CR/LF instances invisible in the output.
108113
109114
### B. Creating a log table with event data in a DDL trigger
110-
The following example creates a table to store information about all database level events, and populates the table with a DDL trigger. The event type and [!INCLUDE[tsql](../../includes/tsql-md.md)] statement are captured by using XQuery against the XML data generated by `EVENTDATA`.
115+
This example creates a table for information storage about all database level events, and populates that table with a DDL trigger. Use of XQuery against the XML data generated by `EVENTDATA` captures the event type and the [!INCLUDE[tsql](../../includes/tsql-md.md)] statement.
111116

112117
```
113118
USE AdventureWorks2012;

docs/t-sql/functions/fetch-status-transact-sql.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ manager: craigg
2727
# &#x40;&#x40;FETCH_STATUS (Transact-SQL)
2828
[!INCLUDE[tsql-appliesto-ss2008-asdb-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-asdb-xxxx-xxx-md.md)]
2929

30-
Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.
30+
This function returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.
3131

3232
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3333

3434
## Syntax
3535

3636
```
37-
3837
@@FETCH_STATUS
3938
```
4039

@@ -45,20 +44,20 @@ manager: craigg
4544

4645
|Return value|Description|
4746
|------------------|-----------------|
48-
|0|The FETCH statement was successful.|
47+
|&nbsp;0|The FETCH statement was successful.|
4948
|-1|The FETCH statement failed or the row was beyond the result set.|
5049
|-2|The row fetched is missing.|
5150
|-9|The cursor is not performing a fetch operation.|
5251

5352
## Remarks
54-
Because @@FETCH_STATUS is global to all cursors on a connection, use @@FETCH_STATUS carefully. After a FETCH statement is executed, the test for @@FETCH_STATUS must occur before any other FETCH statement is executed against another cursor. The value of @@FETCH_STATUS is undefined before any fetches have occurred on the connection.
53+
Because `@@FETCH_STATUS` is global to all cursors on a connection, use it carefully. After a FETCH statement executes, the test for `@@FETCH_STATUS` must occur before any other FETCH statement executes against another cursor. `@@FETCH_STATUS` is undefined before any fetches have occurred on the connection.
5554

56-
For example, a user executes a FETCH statement from one cursor, and then calls a stored procedure that opens and processes the results from another cursor. When control is returned from the called stored procedure, @@FETCH_STATUS reflects the last FETCH executed in the stored procedure, not the FETCH statement executed before the stored procedure is called.
55+
For example, a user executes a FETCH statement from one cursor, and then calls a stored procedure that opens and processes results from another cursor. When control returns from that called stored procedure, `@@FETCH_STATUS` reflects the last FETCH executed inside that stored procedure, not the FETCH statement executed before the call to the stored procedure.
5756

58-
To retrieve the last fetch status of a specific cursor, query the **fetch_status** column of the **sys.dm_exec_cursors** dynamic management function.
57+
To retrieve the last fetch status of a specific cursor, query the **fetch_status** column of the **sys.dm_exec_cursors** dynamic management function.
5958

6059
## Examples
61-
The following example uses `@@FETCH_STATUS` to control cursor activities in a `WHILE` loop.
60+
This example uses `@@FETCH_STATUS` to control cursor activities in a `WHILE` loop.
6261

6362
```
6463
DECLARE Employee_Cursor CURSOR FOR

docs/t-sql/functions/file-id-transact-sql.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ manager: craigg
3030
# FILE_ID (Transact-SQL)
3131
[!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)]
3232

33-
Returns the file identification (ID) number for the given logical file name in the current database.
33+
For the given logical name for a component file of the current database, this function returns the file identification (ID) number.
3434

3535
> [!IMPORTANT]
3636
> [!INCLUDE[ssNoteDepFutureAvoid](../../includes/ssnotedepfutureavoid-md.md)] Use [FILE_IDEX](../../t-sql/functions/file-idex-transact-sql.md) instead.
@@ -40,25 +40,26 @@ manager: craigg
4040
## Syntax
4141

4242
```
43-
4443
FILE_ID ( file_name )
4544
```
4645

4746
## Arguments
48-
*file_name*
49-
Is an expression of type **sysname** that represents the name of the file for which to return the file ID.
47+
*file_name*
48+
An expression of type **sysname**, representing the logical name of the file whose file ID value `FILE_ID` will return.
5049

5150
## Return Types
52-
**smallint**
51+
**smallint**
5352

5453
## Remarks
55-
*file_name* corresponds to the logical file name displayed in the name column in the sys.master_files or sys.database_files catalog views.
54+
*file_name* corresponds to the logical file name displayed in the name column of the sys.master_files or sys.database_files catalog views.
55+
56+
`FILE_ID` returns `NULL` if *file_name* does not correspond to the logical name of a component file of the current database.
5657

57-
In [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], the file identification number assigned to full-text catalogs is greater than 32767. Because the return type of the FILE_ID function is **smallint**, this function cannot be used for full-text files. Use [FILE_IDEX](../../t-sql/functions/file-idex-transact-sql.md) instead.
58+
In [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], the file identification number assigned to full-text catalogs exceeds 32767. Because the `FILE_ID` function has a **smallint** return type, `FILE_ID` will not support full-text files. Use [FILE_IDEX](../../t-sql/functions/file-idex-transact-sql.md) instead.
5859

5960
## Examples
60-
The following example returns the file ID for the `AdventureWorks_Data` file.
61-
61+
This example returns the file ID value for the `AdventureWorks_Data` file, a component file of the `ADVENTUREWORKS2012` database.
62+
6263
```sql
6364
USE AdventureWorks2012;
6465
GO

docs/t-sql/functions/file-name-transact-sql.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ manager: craigg
3333
# FILE_NAME (Transact-SQL)
3434
[!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)]
3535

36-
Returns the logical file name for the given file identification (ID) number.
36+
This function returns the logical file name for a given file identification (ID) number.
3737

3838
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3939

@@ -44,17 +44,17 @@ FILE_NAME ( file_id )
4444
```
4545

4646
## Arguments
47-
*file_id*
48-
Is the file identification number for which to return the file name. *file_id* is **int**.
47+
*file_id*
48+
The file identification number whose file name `FILE_NAME` will return. *file_id* has an **int** data type.
4949

5050
## Return Types
51-
**nvarchar(128)**
51+
**nvarchar(128)**
5252

5353
## Remarks
54-
*file_ID* corresponds to the file_id column in the sys.master_files or sys.database_files catalog views.
54+
*file_ID* corresponds to the file_id column in the sys.master_files catalog view or the sys.database_files catalog view.
5555

5656
## Examples
57-
The following example returns the file names for `file_ID 1` and `file_ID` in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
57+
This example returns the file names for `file_ID 1` and `file_ID` in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
5858

5959
```sql
6060
SELECT FILE_NAME(1) AS 'File Name 1', FILE_NAME(2) AS 'File Name 2';
@@ -64,9 +64,9 @@ GO
6464
[!INCLUDE[ssResult](../../includes/ssresult-md.md)]
6565

6666
```
67-
File Name 1 File Name 2
68-
---------------- ------------------------
69-
AdventureWorks2012_Data AdventureWorks2012_Log
67+
File Name 1 File Name 2
68+
------------------------- ------------------------
69+
AdventureWorks2012_Data AdventureWorks2012_Log
7070
7171
(1 row(s) affected)
7272
```

docs/t-sql/functions/filegroup-id-transact-sql.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,35 @@ manager: craigg
2929
# FILEGROUP_ID (Transact-SQL)
3030
[!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)]
3131

32-
Returns the filegroup identification (ID) number for a specified filegroup name.
32+
This function returns the filegroup identification (ID) number for a specified filegroup name.
3333

3434
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3535

3636
## Syntax
3737

3838
```
39-
4039
FILEGROUP_ID ( 'filegroup_name' )
4140
```
4241

4342
## Arguments
44-
**'** *filegroup_name* **'**
45-
Is an expression of type **sysname** that represents the filegroup name for which to return the filegroup ID.
43+
*filegroup_name*
44+
An expression of type **sysname**, representing the filegroup name whose filegroup ID `FILEGROUP_ID` will return.
4645

4746
## Return Types
48-
**int**
47+
**int**
4948

5049
## Remarks
51-
*filegroup_name* corresponds to the **name** column in the **sys.filegroups** catalog view.
50+
*filegroup_name* corresponds to the **name** column in the **sys.filegroups** catalog view.
5251

5352
## Examples
54-
The following example returns the filegroup ID for the filegroup named `PRIMARY` in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
53+
This example returns the filegroup ID for the filegroup named `PRIMARY` in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
5554

5655
```
57-
5856
SELECT FILEGROUP_ID('PRIMARY') AS [Filegroup ID];
5957
GO
6058
```
6159

62-
[!INCLUDE[ssResult](../../includes/ssresult-md.md)]
60+
[!INCLUDE[ssResult](../../includes/ssresult-md.md)]
6361

6462
```
6563
Filegroup ID

docs/t-sql/functions/filegroup-name-transact-sql.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,31 @@ manager: craigg
3232
# FILEGROUP_NAME (Transact-SQL)
3333
[!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)]
3434

35-
Returns the filegroup name for the specified filegroup identification (ID) number.
35+
This function returns the filegroup name for the specified filegroup identification (ID) number.
3636

3737
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3838

3939
## Syntax
4040

4141
```
42-
4342
FILEGROUP_NAME ( filegroup_id )
4443
```
4544

4645
## Arguments
4746
*filegroup_id*
48-
Is the filegroup ID number for which to return the filegroup name. *filegroup_id* is **smallint**.
47+
48+
The filegroup ID number whose filegroup name `FILEGROUP_NAME` will return. *filegroup_id* has a **smallint** data type.
4949

5050
## Return Types
51-
**nvarchar(128)**
51+
**nvarchar(128)**
5252

5353
## Remarks
54-
*filegroup_id* corresponds to the **data_space_id** column in the **sys.filegroups** catalog view.
54+
*filegroup_id* corresponds to the **data_space_id** column of the **sys.filegroups** catalog view.
5555

5656
## Examples
57-
The following example returns the filegroup name for the filegroup ID `1` in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
57+
This example returns the filegroup name for filegroup ID `1` in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
5858

5959
```
60-
6160
SELECT FILEGROUP_NAME(1) AS [Filegroup Name];
6261
GO
6362
```

docs/t-sql/functions/ntile-transact-sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
title: "NTILE (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "03/16/2017"
@@ -41,7 +41,7 @@ NTILE (integer_expression) OVER ( [ <partition_by_clause> ] < order_by_clause >
4141

4242
## Arguments
4343
*integer_expression*
44-
Is a positive integer constant expression that specifies the number of groups into which each partition must be divided. *integer_expression* can be of type **int**, or **bigint**.
44+
Is a positive integer expression that specifies the number of groups into which each partition must be divided. *integer_expression* can be of type **int**, or **bigint**.
4545

4646
\<partition_by_clause>
4747
Divides the result set produced by the [FROM](../../t-sql/queries/from-transact-sql.md) clause into partitions to which the function is applied. For the PARTITION BY syntax, see [OVER Clause &#40;Transact-SQL&#41;](../../t-sql/queries/select-over-clause-transact-sql.md).

0 commit comments

Comments
 (0)