Skip to content

Commit a9185ad

Browse files
committed
Add DATETFROMPARTS recommendation, fix links
1 parent 0092b4e commit a9185ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

SQL Server Name Convention and T-SQL Programming Style.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ This is only recommendations! But it is consistent for choosing only 1 function
211211
| [`GETDATE`] | [`SYSUTCDATETIME`] | Daylight Saving Time and other factors can play havoc with our dates and times, rounding to the nearest 3 milliseconds. | [25] |
212212
| [`GETUTCDATE`] | [`SYSUTCDATETIME`] | Daylight Saving Time and other factors can play havoc with our dates and times, rounding to the nearest 3 milliseconds. | [25] |
213213
| [`SYSDATETIME`] | [`SYSUTCDATETIME`] | Daylight Saving Time and other factors can play havoc with our dates and times, rounding to the nearest 3 milliseconds. | [25] |
214-
| [`CURRENT_TIMESTAMP`] | [`SYSUTCDATETIME`] | It's too similar to the poorly-named TIMESTAMP data type, which has nothing to do with dates and times and should be called ROWVERSION. | [26] |
215-
| [`DATETIMEFROMPARTS`] | [`DATETIME2FROMPARTS`] | It's too similar to the poorly-named TIMESTAMP data type, which has nothing to do with dates and times and should be called ROWVERSION. | [26] |
214+
| [`CURRENT_TIMESTAMP`] | [`SYSUTCDATETIME`] | It's too similar to the poorly-named TIMESTAMP data type, which has nothing to do with dates and times and should be called `ROWVERSION`. | [26] |
215+
| [`DATETFROMPARTS`] | [`DATET2FROMPARTS`] | The `datetime` data type returns a value to the nearest three milliseconds, as long as it ends with 0, 3, and 7. This is data corruption by definition. | [26] |
216+
| [`DATETIMEFROMPARTS`] | [`DATETIME2FROMPARTS`] | The `datetime` data type returns a value to the nearest three milliseconds, as long as it ends with 0, 3, and 7. This is data corruption by definition. | [26] |
216217
| [`ISDATE`] | [`TRY_CONVERT`] | `ISNUMERIC` can often lead to data type conversion errors, when importing data. For SQL Server below 2012 use `WHERE` with `LIKE`. | [26] |
217218
| [`BETWEEN`] | `>=` and `<=` | Always use an open-ended range to prevent erroneously including or excluding rows. It's much less complex to find the beginning of the next period than the end of the current period. | [27] |
218219

@@ -243,7 +244,10 @@ This is only recommendations! But it is consistent for choosing only 1 function
243244
[`GETDATE`]:https://docs.microsoft.com/sql/t-sql/functions/getdate-transact-sql
244245
[`GETUTCDATE`]:https://docs.microsoft.com/sql/t-sql/functions/getutcdate-transact-sql
245246
[`SYSDATETIME`]:https://docs.microsoft.com/sql/t-sql/functions/sysdatetime-transact-sql
247+
[`CURRENT_TIMESTAMP`]:https://docs.microsoft.com/sql/t-sql/functions/current-timestamp-transact-sql
246248
[26]:https://bornsql.ca/blog/dates-and-times-in-sql-server-more-functions-you-should-never-use/
249+
[`DATETFROMPARTS`]:https://docs.microsoft.com/sql/t-sql/functions/datefromparts-transact-sql
250+
[`DATETIMEFROMPARTS`]:https://docs.microsoft.com/sql/t-sql/functions/datetimefromparts-transact-sql
247251
[`ISDATE`]:https://docs.microsoft.com/sql/t-sql/functions/isdate-transact-sql
248252
[`BETWEEN`]:https://docs.microsoft.com/sql/t-sql/language-elements/between-transact-sql?view=sql-server-ver15
249253
[27]:https://www.mssqltips.com/sqlservertip/5206/sql-server-datetime-best-practices/

0 commit comments

Comments
 (0)