Skip to content

Introduction

Purpose

  • Describes the Application Development and Support Directorate's coding standard for writing T-SQL.

  • Demonstrates the importance of following good practice by quoting examples of working practices that have contributed to clinical incidents.

Scope

Software Developers have a responsibility to follow this guide.

  • Developers not using T-SQL may need to adjust to their version of SQL or consider the need for a local coding standard.

Conventions

The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL in this document are to be interpreted as described in RFC 2119.

Practical tips

Practical tips

Examples of good practice

Examples of good practice...

Practices to avoid

...and practices to avoid

Redgate SQL Prompt

Indicates that this rule can be implemented using Redgate SQL Prompt

Further reading and information

Note Links to SQL Server content in Microsoft Learn© default to SQL Server 2022. Use its version selector to tailor the website for other versions.

The need for guidance

Use this standard to -

  • write code in a consistent way. So that those who read it may draw on previous experience to understand it more quickly.

  • produce software that is based on good practice, is maintainable, performant and secure.