Skip to content

Commit 6edaf47

Browse files
authored
Fix broken links, update info for recommended functions
1 parent 7aa8d91 commit 6edaf47

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,9 @@ This is only recommendations! But it is consistent for choosing only 1 function
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] |
214214
| [`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] |
216215
| [`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] |
217216
| [`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] |
218-
| [`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] |
217+
| [`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] |
219218

220219
[12]:https://docs.microsoft.com/sql/t-sql/language-elements/comparison-operators-transact-sql
221220
[13]:https://dba.stackexchange.com/a/155670/107045
@@ -242,14 +241,18 @@ This is only recommendations! But it is consistent for choosing only 1 function
242241
[24]:https://www.red-gate.com/hub/product-learning/sql-prompt/sql-prompt-code-analysis-avoid-using-isnumeric-function-e1029
243242
[25]:https://bornsql.ca/blog/dates-times-sql-server-t-sql-functions-get-current-date-time/
244243
[`GETDATE`]:https://docs.microsoft.com/sql/t-sql/functions/getdate-transact-sql
244+
[`SYSUTCDATETIME`]:https://docs.microsoft.com/en-gb/sql/t-sql/functions/sysutcdatetime-transact-sql
245245
[`GETUTCDATE`]:https://docs.microsoft.com/sql/t-sql/functions/getutcdate-transact-sql
246246
[`SYSDATETIME`]:https://docs.microsoft.com/sql/t-sql/functions/sysdatetime-transact-sql
247247
[`CURRENT_TIMESTAMP`]:https://docs.microsoft.com/sql/t-sql/functions/current-timestamp-transact-sql
248248
[26]:https://bornsql.ca/blog/dates-and-times-in-sql-server-more-functions-you-should-never-use/
249249
[`DATETFROMPARTS`]:https://docs.microsoft.com/sql/t-sql/functions/datefromparts-transact-sql
250250
[`DATETIMEFROMPARTS`]:https://docs.microsoft.com/sql/t-sql/functions/datetimefromparts-transact-sql
251+
[`DATETIME2FROMPARTS`]:https://docs.microsoft.com/sql/t-sql/functions/datetime2fromparts-transact-sql
251252
[`ISDATE`]:https://docs.microsoft.com/sql/t-sql/functions/isdate-transact-sql
252-
[`BETWEEN`]:https://docs.microsoft.com/sql/t-sql/language-elements/between-transact-sql?view=sql-server-ver15
253+
[`BETWEEN`]:https://docs.microsoft.com/sql/t-sql/language-elements/between-transact-sql
254+
[`>=`]:https://docs.microsoft.com/en-us/sql/t-sql/language-elements/greater-than-or-equal-to-transact-sql
255+
[`<=`]:https://docs.microsoft.com/en-us/sql/t-sql/language-elements/less-than-or-equal-to-transact-sql
253256
[27]:https://www.mssqltips.com/sqlservertip/5206/sql-server-datetime-best-practices/
254257

255258
**[⬆ back to top](#table-of-contents)**
@@ -344,7 +347,7 @@ SQL Server T-SQL Coding Conventions, Best Practices, and Programming Guidelines.
344347
`INFORMATION_SCHEMA` views only represent a subset of the metadata of an object. The only reliable way to find the schema of a object is to query the `sys.objects` catalog view.
345348
- When more than one logical operator is used always use parentheses, even when they are not required.
346349
This can improve the readability of queries, and reduce the chance of making a subtle mistake because of operator precedence.
347-
There is no significant performance penalty in using parentheses. More details [here](https://docs.microsoft.com/en-us/sql/relational-databases/query-processing-architecture-guide?view=sql-server-ver15#logical-operator-precedence).
350+
There is no significant performance penalty in using parentheses. More details [here](https://docs.microsoft.com/en-us/sql/relational-databases/query-processing-architecture-guide#logical-operator-precedence).
348351
```sql
349352
SELECT
350353
ProductID

0 commit comments

Comments
 (0)