Skip to content

Follow our code layout rules

These rules apply to decorative changes that affect whitespace such as tabs, spaces and line breaks. Nonetheless, it's important to adhere to a standard, to help others understand the intent of code.

So, while SQL Prompt allows us to write code in a format, we find comfortable, we must always apply our standard styling rules1 before sharing code and checking it into source control.

You SHOULD format and analyse your code using SQL Prompt before checking into source control.

You SHOULD configure SQL Prompt with our rule. See SQL Prompt configuration for help with using our standard SQL Prompt config files.

Aliases

You SHOULD:-

  • Alias ALL table names using the convention AS <alias>.

  • Use meaningful alias names, following our naming conventions (see later in this document.)

  • Qualify each column with the parent table or alias, especially where the parent table is part of a join or subquery.

Code comments

You SHOULD use the code headers provided in SQL Server Management Studio's (SSMS) default templates to comment scripts, stored procedures, functions and the like.


  1. In this regard, SQL prompt is necessary to implement the standard