Skip to content

Update T-SQL Style Guidance - #839

Merged
mkincaid-bw merged 11 commits into
mainfrom
sql-style-guidance
Aug 13, 2026
Merged

Update T-SQL Style Guidance#839
mkincaid-bw merged 11 commits into
mainfrom
sql-style-guidance

Conversation

@mkincaid-bw

Copy link
Copy Markdown
Contributor

📔 Objective

Update SQL style guidance for various sections.

Establishes the rule that datetime values must be generated in application
code and passed as parameters rather than using SYSUTCDATETIME()/GETUTCDATE()
inline. Documents the four accepted exceptions found in the codebase:
account revision date bumping, bulk operations with consistent timestamps,
WHERE clause predicates, and nullable parameter fallbacks.
…ance

Clarifies stored procedure naming with standard action verbs, moves
parameter guidance to the basic structure section, adds a naming
convention for full unabbreviated names, and notes EDD constraints on
deployment scripts.
Expands user defined types guidance with OPENJSON examples for
passing structured data as an alternative to new TVPs, clarifies
parameter values should come from application code, and adds
guidance against wrapping single statements in explicit transactions
based on existing anti-patterns in the codebase.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploying contributing-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 34070c5
Status: ✅  Deploy successful!
Preview URL: https://2c1cfca0.contributing-docs.pages.dev
Branch Preview URL: https://sql-style-guidance.contributing-docs.pages.dev

View logs

@mkincaid-bw
mkincaid-bw marked this pull request as ready for review August 11, 2026 14:31
@mkincaid-bw
mkincaid-bw requested a review from a team as a code owner August 11, 2026 14:31
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This is a documentation-only change to docs/contributing/code-style/sql.md, expanding the T-SQL style guidance with standard stored procedure action verbs, datetime generation rules and their accepted exceptions, explicit transaction guidance, JSON/OPENJSON structured-parameter patterns, and an EDD note in the deployment scripts section. It also corrects several factual errors in existing examples (DROP IF EXISTSDROP TABLE|VIEW|PROCEDURE IF EXISTS, "when spanning multiple lines", stale INCLUDE ([AccessAll]) index example). All new SQL examples are syntactically valid, the new anchors (#datetime-values, #user-defined-types, #error-handling) and the ../database-migrations/edd link resolve, and Lint/Build checks pass.

Code Review Details

No findings at or above the reporting threshold.

Out-of-scope note (pre-existing, not introduced by this PR): the "This is better" snippet in the Adding a column to a table section has an unbalanced parenthesis — IF COL_LENGTH('[dbo].[Table]', 'Column' IS NULL — the same class of copy-paste error this PR fixes elsewhere, if you want to sweep it up while you're in the file.

Comment thread docs/contributing/code-style/sql.md Outdated
Comment thread docs/contributing/code-style/sql.md Outdated
Comment thread docs/contributing/code-style/sql.md Outdated
Comment thread docs/contributing/code-style/sql.md
Comment thread docs/contributing/code-style/sql.md Outdated

@withinfocus withinfocus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate the updates. Looks solid.

@mkincaid-bw
mkincaid-bw merged commit 5254735 into main Aug 13, 2026
45 checks passed
@mkincaid-bw
mkincaid-bw deleted the sql-style-guidance branch August 13, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants