Skip to content

Commit bfe9d1e

Browse files
committed
Add 2 new recommendation
1 parent 3b6e1e2 commit bfe9d1e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ SQL Server T-SQL Coding Conventions, Best Practices, and Programming Guidelines.
315315
- Do not use a scalar user-defined function (UDF) in a `JOIN` condition, `WHERE` search condition, or in a `SELECT` list, unless the function is [schema-bound](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql#best-practices).
316316
More details [here](https://www.red-gate.com/hub/product-learning/sql-prompt/misuse-scalar-user-defined-function-constant-pe017).
317317
- For scalar function use [`WITH SCHEMABINDING`](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql#best-practices) option to get a performance boost. More details [here](https://bertwagner.com/2018/12/04/two-words-for-faster-scalar-functions/)
318+
- Do not use [`INFORMATION_SCHEMA`] views to determine the schema of an object. [`INFORMATION_SCHEMA`] views only represent a **subset of the metadata** of an object.
319+
The only reliable way to find the schema of a object is to query the [`sys.objects`](https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-objects-transact-sql) catalog view.
320+
More details [here](https://github.com/MicrosoftDocs/sql-docs/issues/4188).
321+
- Do not use explicit transactions for DML and DDL especially for reorganize index because the locking behavior of this statemnets becomes more restrictive.
322+
More details [here](https://github.com/MicrosoftDocs/sql-docs/pull/4011).
318323
- In [sqlcmd](https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility) move the `-U`and `-P` parameters after the `-Q` parameter so that the password is at the end of the command.
319324
More details [here](https://bornsql.ca/blog/the-curious-case-of-the-sqlcmd-password/)
320325
```
@@ -635,3 +640,4 @@ More details [here](http://www.sqlservertutorial.net/sql-server-stored-procedure
635640
[`sp_executesql`]:https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-executesql-transact-sql
636641
[`EXEC`]:https://docs.microsoft.com/en-us/sql/t-sql/language-elements/execute-transact-sql
637642
[10]:https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql
643+
[`INFORMATION_SCHEMA`]:https://docs.microsoft.com/en-us/sql/relational-databases/system-information-schema-views/system-information-schema-views-transact-sql

0 commit comments

Comments
 (0)