Code formatting

External Article

Laying out SQL Code

  • Article

It is important to ensure that SQL code is laid out the best way for the team that has to use and maintain it. Before you work out how to enforce a standard, one has to work out what that standard should be for the application. So do you dive into detail or create an overall logic to the way it is done?

2010-02-05

4,843 reads

External Article

Transact-SQL Formatting Standards (Coding Styles)

  • Article

How should SQL code be formatted? What sort of indentation should you use? Should keywords be in upper case? How should lists be lined up? SQL is one of those languages that will execute anyway however you treat whitespace and capitalization. However, the way SQL is laid out will effect its readability and the time taken to review and understand it. Standardisation of code layout is an important issue, but what standard should you adopt? Rob avoids a direct answer, but tells you the sort of answers you'll need to decide upon when creating a strategy for formatting SQL code.

2009-09-08

4,913 reads

Blogs

Comparing Microsoft Fabric Alternatives in AWS, GCP, and OCI in 2025

By

Microsoft's unified analytics platform, Fabric, simplifies integration across various tools in Azure by offering...

Techno Security East: Quantum Computing Slides

By

I always try and ensure that I post my slides to my talks here...

A Basic Update Trigger: #SQLNewBlogger

By

I had someone ask me about using triggers to detect changes in their tables....

Read the latest Blogs

Forums

SSIS raw file conversion

By bokswager

Hi, Does anyone know how to handle a raw data file where some rows...

Force Strict Encryption - SQL Agent fails

By gustaw1234

Hi, On my SQL 2022 (16.0.4195.2) test environment, I tried to enable Force Strict...

Error converting data type varchar to float

By water490

Hi everyone I have a bunch of CSV files that I need to import...

Visit the forum

Question of the Day

How Many Nested Triggers?

I have DDL trigger code that I'm working on in SQL Server 2022, but I am concerned that we might end up with multiple triggers firing and the response to the user is delayed. If I want to check how many triggers have fired, or are nested, how can I do this in my code?

See possible answers