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

Time to Revive our YouTube Channel

By

It’s been forgotten about and neglected for few years but I’ve decided to dust...

Microsoft MVP 2025: Continuing the Data Platform Journey

By

I am honored to announce that I have been renewed as a Microsoft MVP...

What is KTLO? Keep The Lights On vs Project Work in Agile

By

🔍 Demystifying KTLO: A Deep Dive into Keep The Lights On Work in IT...

Read the latest Blogs

Forums

How a Legacy Logic Choked SQL Server in a 30-Year-Old Factory

By Chandan Shukla

Comments posted to this topic are about the item How a Legacy Logic Choked...

Import/Export SSMS Settings issue

By Brandie Tarvin

I have tried a number of times to export and then import my SSMS...

FQDN - SQL cannot connect when the server name has backslash

By krypto69

Hi I need to connect to a SQL server via FQDN -  that is...

Visit the forum

Question of the Day

Query Plan Regressions --

For the Question of the day, I am going to go deep, but try to be more clear, as I feel like I didn't give enough info last time, leading folks to guess the wrong answer... :) For today's question:  You’re troubleshooting a performance issue on a critical stored procedure. You notice that a previously efficient query now performs a full table scan instead of an index seek. Upon investigating, you find that an NVARCHAR parameter is being compared to a VARCHAR column in the WHERE clause. What is the most likely cause of the query plan regression?

See possible answers