This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Padded sleeve board supporting a jacket sleeve beside an unsupported sleeve

Column Aliases: Where You Can Use Them and Where You Cannot

June 8, 2014
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Column, SQL Order By

Why does WHERE say the alias does not exist? Here is the order SQL Server follows, two clean fixes and one quiet trap to avoid.

Read More
An open wooden toolbox on a bench with a pair of pliers inside and a small blank paper tag tied on with red string.

SQL Code Comments: Notes Your Future Self Can Read

August 9, 2013
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Scripts, SQL Server Management Studio, Starting SQL

SQL Code Comments are the notes SQL Server skips and your teammates read. This post shows the two comment styles, what is worth writing in them, a header block for scripts and procedures, and how to stop a comment from lying after the code changes.

Read More
A cat with a red collar passes through a cat flap while a stray waits outside.

Enforcing Object Naming Rules With a DDL Trigger

June 8, 2013
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Server, SQL Trigger

Enforce procedure and index names with a DDL trigger, inspect EVENTDATA, audit rejected attempts, and list existing violations.

Read More
Two panels. On the left, a join query with a gray comment line and a note about dashes and block marks. On the right, the same query without the comment, followed by its five result rows.

Why We Use Code Comments in SQL Server: Say Why, Not What

February 25, 2013
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Documentation, SQL Scripts, SQL Server

Why we use code comments comes down to one habit: write the reason, not the action. This post uses a small library table to show single-line and block comments, commenting out a join to test a theory, the Msg 156 trap, nested comments, and whether comments slow a query. Every result comes from SQL Server 2025.

Read More
A half-built brick wall with even mortar joints, a taut string line along the top and a trowel on the last brick.

Formatting T-SQL Consistently Across a Team

February 14, 2013
Pinal Dave
SQL Tips and Tricks
Best Practices, Software Development, SQL Coding Standards, SQL Server

Formatting T-SQL consistently means choosing a few readable rules, using a formatter carefully, and keeping historical changes focused.

Read More
Gouache painting of a jumbled heap of pencils beside a neat row with a red pencil sharpener between them

Autocomplete and Code Formatting in SSMS: What Works Today

January 30, 2013
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL Coding Standards, SQL Server Management Studio, SQL Shortcut

Autocomplete and code formatting save time and prevent mistakes when they are set up well. This post covers the IntelliSense features in SSMS, the reasons they stop working, a simple formatting style, and a tested look at what formatting changes in the plan cache.

Read More
Gouache painting of a branching ribbon connecting grouped paper strips on a wooden clipboard and in a drawer.

Comment T-SQL in SSMS: SQL in Sixty Seconds #019

July 4, 2012
Pinal Dave
SQL Video
SQL Coding Standards, SQL in Sixty Seconds, SQL Server Management Studio, SQL Shortcut

You can comment T-SQL in SSMS with a keyboard shortcut, a toolbar button or the Edit menu. The tests here show nested block comments, an UPDATE that lost its WHERE clause, a dangling comma after a commented column, and an unclosed comment, on SQL Server 2025.

Read More
Previous 1 2 3 4 5 … 7 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com