Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 00daaea

Browse files
authored
Merge pull request #17069 from icoric/icoric-patch-12
sql colorizer updates - tsql docs / functions pt.3
2 parents 006db6e + b8361a4 commit 00daaea

94 files changed

Lines changed: 446 additions & 483 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/t-sql/functions/pack-received-transact-sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ms.author: vanto
3030

3131
## Syntax
3232

33-
```
33+
```syntaxsql
3434
@@PACK_RECEIVED
3535
```
3636

@@ -45,7 +45,7 @@ ms.author: vanto
4545
## Examples
4646
The following example shows the usage of `@@PACK_RECEIVED`.
4747

48-
```
48+
```sql
4949
SELECT @@PACK_RECEIVED AS 'Packets Received';
5050
```
5151

docs/t-sql/functions/pack-sent-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ms.author: vanto
3333

3434
## Syntax
3535

36-
```sql
36+
```syntaxsql
3737
@@PACK_SENT
3838
```
3939

docs/t-sql/functions/packet-errors-transact-sql.md

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

3333
## Syntax
3434

35-
```
36-
35+
```syntaxsql
3736
@@PACKET_ERRORS
3837
```
3938

@@ -48,7 +47,7 @@ ms.author: vanto
4847
## Examples
4948
The following example shows using `@@PACKET_ERRORS`.
5049

51-
```
50+
```sql
5251
SELECT @@PACKET_ERRORS AS 'Packet Errors';
5352
```
5453

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ ms.author: jrasnick
2828

2929
## Syntax
3030

31-
```
32-
31+
```syntaxsql
3332
PARSE ( string_value AS data_type [ USING culture ] )
3433
```
3534

@@ -132,7 +131,7 @@ PARSE ( string_value AS data_type [ USING culture ] )
132131

133132
### A. PARSE into datetime2
134133

135-
```
134+
```sql
136135
SELECT PARSE('Monday, 13 December 2010' AS datetime2 USING 'en-US') AS Result;
137136
```
138137

@@ -148,7 +147,7 @@ Result
148147

149148
### B. PARSE with currency symbol
150149

151-
```
150+
```sql
152151
SELECT PARSE('€345,98' AS money USING 'de-DE') AS Result;
153152
```
154153

@@ -164,7 +163,7 @@ Result
164163

165164
### C. PARSE with implicit setting of language
166165

167-
```
166+
```sql
168167
-- The English language is mapped to en-US specific culture
169168
SET LANGUAGE 'English';
170169
SELECT PARSE('12/16/2010' AS datetime2) AS Result;

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ ms.author: jrasnick
2929

3030
## Syntax
3131

32-
```
33-
32+
```syntaxsql
3433
[ database_name. ] $PARTITION.partition_function_name(expression)
3534
```
3635

@@ -59,10 +58,10 @@ ms.author: jrasnick
5958
### A. Getting the partition number for a set of partitioning column values
6059
The following example creates a partition function `RangePF1` that will partition a table or index into four partitions. $PARTITION is used to determine that the value `10`, representing the partitioning column of `RangePF1`, would be put in partition 1 of the table.
6160

62-
```
61+
```sql
6362
USE AdventureWorks2012;
6463
GO
65-
CREATE PARTITION FUNCTION RangePF1 ( int )
64+
CREATE PARTITION FUNCTION RangePF1 ( INT )
6665
AS RANGE FOR VALUES (10, 100, 1000) ;
6766
GO
6867
SELECT $PARTITION.RangePF1 (10) ;
@@ -74,7 +73,7 @@ GO
7473

7574
To execute this example, you must first run the PartitionAW.sql script against the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] sample database. For more information, see [PartitioningScript](https://go.microsoft.com/fwlink/?LinkId=201015).
7675

77-
```
76+
```sql
7877
USE AdventureWorks2012;
7978
GO
8079
SELECT $PARTITION.TransactionRangePF1(TransactionDate) AS Partition,
@@ -90,7 +89,7 @@ GO
9089
> [!NOTE]
9190
> To execute this example, you must first run the PartitionAW.sql script against the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] sample database. For more information, see [PartitioningScript](https://go.microsoft.com/fwlink/?LinkId=201015).
9291
93-
```
92+
```sql
9493
SELECT * FROM Production.TransactionHistory
9594
WHERE $PARTITION.TransactionRangePF1(TransactionDate) = 5 ;
9695
```

docs/t-sql/functions/percent-rank-transact-sql.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ monikerRange: "=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sql
2828

2929
## Syntax
3030

31-
```
31+
```syntaxsql
3232
PERCENT_RANK( )
3333
OVER ( [ partition_by_clause ] order_by_clause )
34-
3534
```
3635

3736
[!INCLUDE[sql-server-tsql-previous-offline-documentation](../../includes/sql-server-tsql-previous-offline-documentation.md)]
@@ -51,7 +50,7 @@ PERCENT_RANK( )
5150
## Examples
5251
The following example uses the CUME_DIST function to compute the salary percentile for each employee within a given department. The value returned by the CUME_DIST function represents the percent of employees that have a salary less than or equal to the current employee in the same department. The PERCENT_RANK function computes the rank of the employee's salary within a department as a percentage. The PARTITION BY clause is specified to partition the rows in the result set by department. The ORDER BY clause in the OVER clause orders the rows in each partition. The ORDER BY clause in the SELECT statement sorts the rows in the whole result set.
5352

54-
```
53+
```sql
5554
USE AdventureWorks2012;
5655
GO
5756
SELECT Department, LastName, Rate,

docs/t-sql/functions/percentile-cont-transact-sql.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ PERCENTILE_CONT ( numeric_literal )
6464
### A. Basic syntax example
6565
The following example uses PERCENTILE_CONT and PERCENTILE_DISC to find the median employee salary in each department. These functions may not return the same value. PERCENTILE_CONT interpolates the appropriate value, which may or may not exist in the data set, while PERCENTILE_DISC always returns an actual value from the set.
6666

67-
```
67+
```sql
6868
USE AdventureWorks2012;
6969

7070
SELECT DISTINCT Name AS DepartmentName
@@ -94,16 +94,15 @@ Human Resources 17.427850 16.5865
9494
### B. Basic syntax example
9595
The following example uses PERCENTILE_CONT and PERCENTILE_DISC to find the median employee salary in each department. These functions may not return the same value. PERCENTILE_CONT interpolates the appropriate value, which may or may not exist in the data set, while PERCENTILE_DISC always returns an actual value from the set.
9696

97-
```
97+
```sql
9898
-- Uses AdventureWorks
9999

100100
SELECT DISTINCT DepartmentName
101101
,PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY BaseRate)
102102
OVER (PARTITION BY DepartmentName) AS MedianCont
103103
,PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY BaseRate)
104104
OVER (PARTITION BY DepartmentName) AS MedianDisc
105-
FROM dbo.DimEmployee;
106-
105+
FROM dbo.DimEmployee;
107106
```
108107

109108
Here is a partial result set.

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ ms.author: vanto
3838
## Syntax
3939

4040
```syntaxsql
41-
4241
PERMISSIONS ( [ objectid [ , 'column' ] ] )
4342
```
4443

@@ -112,7 +111,7 @@ PERMISSIONS ( [ objectid [ , 'column' ] ] )
112111
### A. Using the PERMISSIONS function with statement permissions
113112
The following example determines whether the current user can execute the `CREATE TABLE` statement.
114113

115-
```
114+
```sql
116115
IF PERMISSIONS()&2=2
117116
CREATE TABLE test_table (col1 INT)
118117
ELSE
@@ -122,7 +121,7 @@ ELSE
122121
### B. Using the PERMISSIONS function with object permissions
123122
The following example determines whether the current user can insert a row of data into the `Address` table in the `AdventureWorks2012` database.
124123

125-
```
124+
```sql
126125
IF PERMISSIONS(OBJECT_ID('AdventureWorks2012.Person.Address','U'))&8=8
127126
PRINT 'The current user can insert data into Person.Address.'
128127
ELSE
@@ -132,7 +131,7 @@ ELSE
132131
### C. Using the PERMISSIONS function with grantable permissions
133132
The following example determines whether the current user can grant the INSERT permission on the `Address` table in the `AdventureWorks2012` database to another user.
134133

135-
```
134+
```sql
136135
IF PERMISSIONS(OBJECT_ID('AdventureWorks2012.Person.Address','U'))&0x80000=0x80000
137136
PRINT 'INSERT on Person.Address is grantable.'
138137
ELSE

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-s
3030

3131
## Syntax
3232

33-
```
33+
```syntaxsql
3434
PI ( )
3535
```
3636

@@ -42,7 +42,7 @@ PI ( )
4242
## Examples
4343
The following example returns the value of `PI`.
4444

45-
```
45+
```sql
4646
SELECT PI();
4747
GO
4848
```

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-s
2929

3030
## Syntax
3131

32-
```
32+
```syntaxsql
3333
POWER ( float_expression , y )
3434
```
3535

@@ -61,7 +61,7 @@ If the result does not fit in the return type, an arithmetic overflow error occu
6161
### A. Using POWER to return the cube of a number
6262
The following example demonstrates raising a number to the power of 3 (the cube of the number).
6363

64-
```
64+
```sql
6565
DECLARE @input1 FLOAT;
6666
DECLARE @input2 FLOAT;
6767
SET @input1= 2;
@@ -82,7 +82,7 @@ Result1 Result2
8282
### B. Using POWER to show results of data type conversion
8383
The following example shows how the *float_expression* preserves the data type which can return unexpected results.
8484

85-
```
85+
```sql
8686
SELECT
8787
POWER(CAST(2.0 AS FLOAT), -100.0) AS FloatResult,
8888
POWER(2, -100.0) AS IntegerResult,
@@ -104,7 +104,7 @@ FloatResult IntegerResult IntegerResult Decimal1Result Decimal2Result
104104
### C. Using POWER
105105
The following example returns `POWER` results for `2`.
106106

107-
```
107+
```sql
108108
DECLARE @value INT, @counter INT;
109109
SET @value = 2;
110110
SET @counter = 1;
@@ -148,7 +148,7 @@ GO
148148
### D: Using POWER to return the cube of a number
149149
The following example shows returns `POWER` results for `2.0` to the 3rd power.
150150

151-
```
151+
```sql
152152
SELECT POWER(2.0, 3);
153153
```
154154

0 commit comments

Comments
 (0)