Skip to content

Commit cb2d9f6

Browse files
authored
Update comment recommendation
1 parent bf63cdf commit cb2d9f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ SQL Server T-SQL Coding Conventions, Best Practices, and Programming Guidelines.
262262
[here](https://sqlperformance.com/2014/11/t-sql-queries/multiple-plans-identical-query),
263263
[here](https://sqlblog.org/2019/09/12/bad-habits-to-kick-avoiding-the-schema-prefix).
264264
- Delimiters: **spaces** (not tabs).
265+
- <a id="sql-comment"></a> Always use multi-line comment `/* */` instead in-line comment `--` in production code due to potential formating problems in different tools and programs.
266+
More details [here](https://www.brentozar.com/archive/2021/04/never-ever-ever-start-t-sql-comments-with-two-dashes/) and [here](https://sqlkover.com/ssis-and-the-ora-00907-missing-right-parenthesis-error/).
265267
- Never use asterisk (`*`) in select statements `SELECT *` and `INSERT` statements, use explicit column names.
266268
Main problems are: traffic issues, Memory Grants issues, Index usage issues.
267269
**Only one exception, see it below.**
@@ -538,7 +540,6 @@ Recommendations from Microsoft: [Stored procedure Best practice][11]
538540
- The procedure or function should begin with parameters checks (see example below)
539541
- Create `sp_` procedures only in `master` database - SQL Server will always scan through the system catalog first
540542
- Always use `BEGIN TRY` and `BEGIN CATCH` for error handling
541-
- <a id="sql-comment"></a> Always use multi-line comment `/* */` instead in-line comment `--` in production code due to potential formating problems. More details [here](https://www.brentozar.com/archive/2021/04/never-ever-ever-start-t-sql-comments-with-two-dashes/).
542543
- Use `SET NOCOUNT ON;` for stops the message that shows the count of the number of rows affected by a Transact-SQL statement and decreasing network traffic.
543544
More details [here](https://www.red-gate.com/hub/product-learning/sql-prompt/finding-code-smells-using-sql-prompt-set-nocount-problem-pe008-pe009) and [here][11].
544545
- Do not use `SET NOCOUNT OFF;` because it is default behavior

0 commit comments

Comments
 (0)