Skip to content

Commit ae0e628

Browse files
authored
Updated Typos to the Doc
Updated Typos to the Doc
1 parent 50f5ab6 commit ae0e628

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

articles/azure-sql-edge/date-bucket-tsql.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ ms.date: 05/19/2019
1313

1414
# Date_Bucket (Transact-SQL)
1515

16-
This function distributes aggregate column expressions in different date or time boundaries.
16+
This function returns the datetime value corresponding to the start of each datetime bucket, from the default origin value of `1900-01-01 00:00:00.000`.
1717

1818
See [Date and Time Data Types and Functions (Transact-SQL)](/sql/t-sql/functions/date-and-time-data-types-and-functions-transact-sql/) for an overview of all Transact-SQL date and time data types and functions.
1919

2020
[Transact-SQL Syntax Conventions](/sql/t-sql/language-elements/transact-sql-syntax-conventions-transact-sql/)
2121

22-
`DATE_BUCKET` uses a default origin date value of `1900-01-01 00:00:00.000` for example, 12 AM on Monday the 1 January 1900.
22+
`DATE_BUCKET` uses a default origin date value of `1900-01-01 00:00:00.000` i.e. 12:00 AM on Monday, January 1 1900.
2323

2424
## Syntax
2525

@@ -38,20 +38,16 @@ The part of *date* that is used with the ‘number’ parameter. Ex. Year, month
3838
3939
|*datePart*|Abbreviations|
4040
|---|---|
41-
|**dayofyear**|**dy**, **y**|
4241
|**day**|**dd**, **d**|
4342
|**week**|**wk**, **ww**|
44-
|**weekday**|**dw**, **w**|
4543
|**hour**|**hh**|
4644
|**minute**|**mi**, **n**|
4745
|**second**|**ss**, **s**|
4846
|**millisecond**|**ms**|
49-
|**microsecond**|**mcs**|
50-
|**nanosecond**|**ns**|
5147

5248
*number*
5349

54-
The integer number that decides the width of the bucket combined with *datePart* argument. This represents the width of the dataPart buckets from the origin time.
50+
The integer number that decides the width of the bucket combined with *datePart* argument. This represents the width of the dataPart buckets from the origin time. **`This argument cannot be a negative integer value`**.
5551

5652
*date*
5753

@@ -104,20 +100,26 @@ Select DATE_BUCKET(wk, 5, @date)
104100

105101
## number Argument
106102

107-
The *number* argument cannot exceed the range of **int**. In the following statements, the argument for *number* exceeds the range of **int** by 1. The following statement returns the following error message: "`Msg 8115, Level 16, State 2, Line 2. Arithmetic overflow error converting expression to data type int."`
103+
The *number* argument cannot exceed the range of positive **int** values. In the following statements, the argument for *number* exceeds the range of **int** by 1. The following statement returns the following error message: "`Msg 8115, Level 16, State 2, Line 2. Arithmetic overflow error converting expression to data type int."`
108104

109105
```sql
110106
declare @date datetime2 = '2020-04-30 00:00:00'
111107
Select DATE_BUCKET(dd, 2147483648, @date)
112108
```
113-
109+
110+
If a negative value for number is passed to the `Date_Bucket` function, the following error will be returned.
111+
112+
```sql
113+
Msg 9834, Level 16, State 1, Line 1
114+
Invalid bucket width value passed to date_bucket function. Only positive values are allowed.
115+
````
116+
114117
## date Argument
115118

116-
`DATE_BUCKET` return the base value corresponding to the data type of the `date` argument. If the expression evaluation returns in a datetime overflow, `DATE_BUCKET` will return the default origin time of `1900-01-01 00:00:00.0000000`. For example, the first statement will return an error "`Msg 517, Level 16, State 3, Line 1 Adding a value to a 'datetime2' column caused an overflow."`, while the second statement will return the value `1900-01-01 00:00:00.0000000`
119+
`DATE_BUCKET` return the base value corresponding to the data type of the `date` argument. In the following example, an output value with datetime2 datatype is returned.
117120

118121
```sql
119-
Select DATEADD(dd, -2147483646, SYSUTCDATETIME())
120-
Select DATE_BUCKET(dd, 2147483646, SYSUTCDATETIME())
122+
Select DATE_BUCKET(dd, 10, SYSUTCDATETIME())
121123
```
122124

123125
## Remarks

0 commit comments

Comments
 (0)