You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|Date range|1900-01-01 through 2079-06-06<br /><br /> January 1, 1900, through June 6, 2079|
43
43
|Time range|00:00:00 through 23:59:59<br /><br /> 2007-05-09 23:59:59 will round to<br /><br /> 2007-05-10 00:00:00|
44
-
|Element ranges|YYYY is four digits, ranging from 1900, to 2079, that represent a year.<br /><br /> MM is two digits, ranging from 01 to 12, that represent a month in the specified year.<br /><br /> DD is two digits, ranging from 01 to 31 depending on the month, that represent a day of the specified month.<br /><br /> hh is two digits, ranging from 00 to 23, that represent the hour.<br /><br /> mm is two digits, ranging from 00 to 59, that represent the minute.<br /><br /> ss is two digits, ranging from 00 to 59, that represent the second. Values that are 29.998 seconds or less are rounded down to the nearest minute, Values of 29.999 seconds or more are rounded up to the nearest minute.|
44
+
|Element ranges|YYYY is four digits, ranging from 1900, to 2079, that represent a year.<br /><br /> MM is two digits, ranging from 01 to 12, that represent a month in the specified year.<br /><br /> DD is two digits, ranging from 01 to 31 depending on the month, that represent a day of the specified month.<br /><br /> hh is two digits, ranging from 00 to 23, that represent the hour.<br /><br /> mm is two digits, ranging from 00 to 59, that represent the minute.<br /><br /> ss is two digits, ranging from 00 to 59, that represent the second. Values that are 29.998 seconds or less are rounded down to the nearest minute. Values of 29.999 seconds or more are rounded up to the nearest minute.|
45
45
|Character length|19 positions maximum|
46
46
|Storage size|4 bytes, fixed.|
47
47
|Accuracy|One minute|
48
48
|Default value|1900-01-01 00:00:00|
49
-
|Calendar|Gregorian<br /><br /> (Does not include the complete range of years.)|
49
+
|Calendar|Gregorian<br /><br /> (Doesn't include the complete range of years.)|
50
50
|User-defined fractional second precision|No|
51
51
|Time zone offset aware and preservation|No|
52
52
|Daylight saving aware|No|
53
53
54
54
## ANSI and ISO 8601 Compliance
55
-
**smalldatetime**is not ANSI or ISO 8601 compliant.
55
+
**smalldatetime**isn't ANSI or ISO 8601 compliant.
56
56
57
57
## Converting date and time data
58
-
When you convert to date and time data types, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] rejects all values it cannot recognize as dates or times. For information about using the CAST and CONVERT functions with date and time data, see [CAST and CONVERT (Transact-SQL)](../../t-sql/functions/cast-and-convert-transact-sql.md).
58
+
When you convert to date and time data types, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] rejects all values it can't recognize as dates or times. For information about using the CAST and CONVERT functions with date and time data, see [CAST and CONVERT (Transact-SQL)](../../t-sql/functions/cast-and-convert-transact-sql.md).
59
59
60
60
### Converting smalldatetime to other date and time types
61
61
This section describes what occurs when a **smalldatetime** data type is converted to other date and time data types.
62
62
63
-
In the case of conversion to **date**, the year, month, and day are copied. The following code shows the results of converting a `smalldatetime` value to a `date` value.
63
+
For a conversion to **date**, the year, month, and day are copied. The following code shows the results of converting a `smalldatetime` value to a `date` value.
@@ -108,7 +108,7 @@ SELECT @smalldatetime AS '@smalldatetime', @datetime AS 'datetime';
108
108
--(1 row(s) affected)
109
109
```
110
110
111
-
In the case of conversion to **datetimeoffset(n)**, the **smalldatetime** value is copied to the **datetimeoffset(n)** value. The fractional seconds are set to 0, and the time zone offset is set to +00:0. The following code shows the results of converting a `smalldatetime` value to a `datetimeoffset(4)` value.
111
+
For a conversion to **datetimeoffset(n)**, the **smalldatetime** value is copied to the **datetimeoffset(n)** value. The fractional seconds are set to 0, and the time zone offset is set to +00:0. The following code shows the results of converting a `smalldatetime` value to a `datetimeoffset(4)` value.
Checks the current identity value for the specified table in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and, if it is needed, changes the identity value. You can also use DBCC CHECKIDENT to manually set a new current identity value for the identity column.
36
+
Checks the current identity value for the specified table in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and, if it's needed, changes the identity value. You can also use DBCC CHECKIDENT to manually set a new current identity value for the identity column.
37
37
38
38
39
-
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
39
+
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
40
40
41
41
## Syntax
42
42
@@ -52,10 +52,10 @@ DBCC CHECKIDENT
52
52
53
53
## Arguments
54
54
*table_name*
55
-
Is the name of the table for which to check the current identity value. The table specified must contain an identity column. Table names must comply with the rules for [identifiers](../../relational-databases/databases/database-identifiers.md). Two or three part names must be delimited, such as 'Person.AddressType' or [Person.AddressType].
55
+
Is the name of the table for which to check the current identity value. The table specified must contain an identity column. Table names must follow the rules for [identifiers](../../relational-databases/databases/database-identifiers.md). Two or three part names must be delimited, such as 'Person.AddressType' or [Person.AddressType].
56
56
57
57
NORESEED
58
-
Specifies that the current identity value should not be changed.
58
+
Specifies that the current identity value shouldn't be changed.
59
59
60
60
RESEED
61
61
Specifies that the current identity value should be changed.
@@ -71,31 +71,31 @@ DBCC CHECKIDENT
71
71
72
72
|DBCC CHECKIDENT command|Identity correction or corrections made|
|DBCC CHECKIDENT ( *table_name*, NORESEED )|Current identity value is not reset. DBCC CHECKIDENT returns the current identity value and the current maximum value of the identity column. If the two values are not the same, you should reset the identity value to avoid potential errors or gaps in the sequence of values.|
75
-
|DBCC CHECKIDENT ( *table_name* )<br /><br /> or<br /><br /> DBCC CHECKIDENT ( *table_name*, RESEED )|If the current identity value for a table is less than the maximum identity value stored in the identity column, it is reset using the maximum value in the identity column. See the 'Exceptions' section that follows.|
76
-
|DBCC CHECKIDENT ( *table_name*, RESEED, *new_reseed_value* )|Current identity value is set to the *new_reseed_value*. If no rows have been inserted into the table since the table was created, or if all rows have been removed by using the TRUNCATE TABLE statement, the first row inserted after you run DBCC CHECKIDENT uses *new_reseed_value* as the identity.<br /><br /> If rows are present in the table, the next row is inserted with the *new_reseed_value* + the [current increment](../../t-sql/functions/ident-incr-transact-sql.md) value. In version [!INCLUDE[ssKilimanjaro](../../includes/sskilimanjaro-md.md)] and earlier, the next row inserted uses *new_reseed_value* + the [current increment](../../t-sql/functions/ident-incr-transact-sql.md) value.<br /><br /> If the table is not empty, setting the identity value to a number less than the maximum value in the identity column can result in one of the following conditions:<br /><br /> -If a PRIMARY KEY or UNIQUE constraint exists on the identity column, error message 2627 will be generated on later insert operations into the table because the generated identity value will conflict with existing values.<br /><br /> -If a PRIMARY KEY or UNIQUE constraint does not exist, later insert operations will result in duplicate identity values.|
74
+
|DBCC CHECKIDENT ( *table_name*, NORESEED )|Current identity value isn't reset. DBCC CHECKIDENT returns the current identity value and the current maximum value of the identity column. If the two values aren't the same, you should reset the identity value to avoid potential errors or gaps in the sequence of values.|
75
+
|DBCC CHECKIDENT ( *table_name* )<br /><br /> or<br /><br /> DBCC CHECKIDENT ( *table_name*, RESEED )|If the current identity value for a table is less than the maximum identity value stored in the identity column, it's reset using the maximum value in the identity column. See the 'Exceptions' section that follows.|
76
+
|DBCC CHECKIDENT ( *table_name*, RESEED, *new_reseed_value* )|Current identity value is set to the *new_reseed_value*. If no rows were inserted into the table since the table was created, or if all rows were removed by using the TRUNCATE TABLE statement, the first row inserted after you run DBCC CHECKIDENT uses *new_reseed_value* as the identity.<br /><br /> If rows are present in the table, the next row is inserted with the *new_reseed_value* + the [current increment](../../t-sql/functions/ident-incr-transact-sql.md) value. In version [!INCLUDE[ssKilimanjaro](../../includes/sskilimanjaro-md.md)] and earlier, the next row inserted uses *new_reseed_value* + the [current increment](../../t-sql/functions/ident-incr-transact-sql.md) value.<br /><br /> If the table isn't empty, setting the identity value to a number less than the maximum value in the identity column can result in one of the following conditions:<br /><br /> -If a PRIMARY KEY or UNIQUE constraint exists on the identity column, error message 2627 will be generated on later insert operations into the table. This error is because the generated identity value will conflict with existing values.<br /><br /> -If a PRIMARY KEY or UNIQUE constraint doesn't exist, later insert operations will result in duplicate identity values.|
77
77
78
78
## Exceptions
79
-
The following table lists conditions when DBCC CHECKIDENT does not automatically reset the current identity value and provides methods for resetting the value.
79
+
The following table lists conditions when DBCC CHECKIDENT doesn't automatically reset the current identity value, and provides methods for resetting the value.
80
80
81
81
|Condition|Reset methods|
82
82
|---------------|-------------------|
83
-
|The current identity value is larger than the maximum value in the table.|Execute DBCC CHECKIDENT (*table_name*, NORESEED) to determine the current maximum value in the column, and then specify that value as the *new_reseed_value* in a DBCC CHECKIDENT (*table_name*, RESEED,*new_reseed_value*) command.<br /><br /> -OR-<br /><br /> Execute DBCC CHECKIDENT (*table_name*, RESEED,*new_reseed_value*) with *new_reseed_value* set to a very low value, and then run DBCC CHECKIDENT (*table_name*, RESEED) to correct the value.|
84
-
|All rows are deleted from the table.|Execute DBCC CHECKIDENT (*table_name*, RESEED,*new_reseed_value*) with *new_reseed_value* set to the desired starting value.|
83
+
|The current identity value is larger than the maximum value in the table.|Execute DBCC CHECKIDENT (*table_name*, NORESEED) to determine the current maximum value in the column. Next, specify that value as the *new_reseed_value* in a DBCC CHECKIDENT (*table_name*, RESEED,*new_reseed_value*) command.<br /><br /> -OR-<br /><br /> Execute DBCC CHECKIDENT (*table_name*, RESEED,*new_reseed_value*) with *new_reseed_value* set to a very low value, and then run DBCC CHECKIDENT (*table_name*, RESEED) to correct the value.|
84
+
|All rows are deleted from the table.|Execute DBCC CHECKIDENT (*table_name*, RESEED,*new_reseed_value*) with *new_reseed_value* set to the new starting value.|
85
85
86
86
## Changing the Seed Value
87
-
The seed value is the value inserted into an identity column for the very first row loaded into the table. All subsequent rows contain the current identity value plus the increment value where current identity value is the last identity value generated for the table or view.
87
+
The seed value is the value inserted into an identity column for the first row loaded into the table. All subsequent rows contain the current identity value plus the increment value where current identity value is the last identity value generated for the table or view.
88
88
89
-
You cannot use DBCC CHECKIDENT to perform the following tasks:
89
+
You can't use DBCC CHECKIDENT for the following tasks:
90
90
91
-
- Change the original seed value that was specified for an identity column when the table or view was created.
91
+
- Change the original seed value specified for an identity column when the table or view was created.
92
92
93
93
- Reseed existing rows in a table or view.
94
94
95
-
To change the original seed value and reseed any existing rows, you must drop the identity column and recreate it specifying the new seed value. When the table contains data, the identity numbers are added to the existing rows with the specified seed and increment values. The order in which the rows are updated is not guaranteed.
95
+
To change the original seed value and reseed any existing rows, drop the identity column and recreate it specifying the new seed value. When the table contains data, the identity numbers are added to the existing rows with the specified seed and increment values. The order in which the rows are updated isn't guaranteed.
96
96
97
97
## Result Sets
98
-
Whether or not any of the options are specified for a table that contains an identity column, DBCC CHECKIDENT returns the following message for all operations except when specifying a new seed value.
98
+
Whether or not you specify any options for a table that contains an identity column, DBCC CHECKIDENT returns the following message for all operations except one. That operation is specifying a new seed value.
99
99
100
100
`Checking identity information: current identity value '\<current identity value>', current column value '\<current column value>'. DBCC execution completed. If DBCC printed error messages, contact your system administrator.`
101
101
@@ -108,8 +108,8 @@ DBCC CHECKIDENT
108
108
109
109
## Examples
110
110
111
-
### A. Resetting the current identity value, if it is needed
112
-
The following example resets the current identity value, if it is needed, of the specified table in the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database.
111
+
### A. Resetting the current identity value, if it's needed
112
+
The following example resets the current identity value, if it's needed, of the specified table in the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database.
113
113
114
114
```
115
115
USE AdventureWorks2012;
@@ -119,7 +119,7 @@ GO
119
119
```
120
120
121
121
### B. Reporting the current identity value
122
-
The following example reports the current identity value in the specified table in the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database, and does not correct the identity value if it is incorrect.
122
+
The following example reports the current identity value in the specified table in the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database, and doesn't correct the identity value if it's incorrect.
Displays the size and number of rows for each partition of a table in a [!INCLUDE[ssSDW](../../includes/sssdw-md.md)] or [!INCLUDE[ssPDW](../../includes/sspdw-md.md)] database.
20
20
21
-
[Transact-SQL Syntax Conventions (Transact-SQL)](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
21
+
[Transact-SQL Syntax Conventions (Transact-SQL)](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
0 commit comments