Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.76 KB

File metadata and controls

56 lines (40 loc) · 1.76 KB

Contributing to SQL Field Notes

Thanks for adding to the field guide. A contribution should be understandable without access to the project where the query originated.

Before submitting

  • Put the file in the correct engine folder.
  • Use a descriptive PascalCase.sql filename.
  • Keep one primary task per script.
  • Remove company, customer, product, host, server, and internal database names.
  • Remove credentials, tokens, connection strings, IP addresses, emails, and production data.
  • Replace business-specific tables and columns with neutral examples.
  • Prefer a read-only diagnostic or command generator when automatic mutation is unnecessary.
  • Test with the oldest engine version named in the header.

Header template

/*
Purpose:
- Describe the question answered or operation performed.

Safety:
- Read-only | Generates commands | Changes state.
- Call out locks, scans, elevated permissions, or destructive behavior.

Requirements:
- Database engine and minimum version.
- Required permissions or extensions.

Customization:
- List every placeholder or threshold that should be reviewed.
*/

Placeholder convention

Use angle-bracket placeholders for values that cannot run as-is:

USE [<DATABASE_NAME>];
-- <SCHEMA_NAME>, <TABLE_NAME>, <LOGIN_NAME>

Use neutral executable objects only when they make the example easier to understand: dbo.Orders, app.Customer, or reporting_reader.

Safety review

Before opening a pull request, search the changed files for:

password=  pwd=  user id=  data source=  initial catalog=
http://    10.x.x.x    172.16-31.x.x    192.168.x.x

Also review every USE, three-part object name, CREATE USER, CREATE LOGIN, ALTER, DROP, DELETE, UPDATE, KILL, and server-level trigger by hand.