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
Three boxes for the same eight pledges: a plain SUM returns 1 row holding 4,800.00, GROUP BY MemberID returns 6 rows, one per member, and SUM with OVER returns all 8 rows, each with the total

Aggregate and Detail Columns in One Query: GROUP BY or OVER

February 26, 2013
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Group By, SQL Scripts, SQL Server

Aggregate and detail columns in one query fail with Msg 8120 until you pick a way to keep the rows. This post compares GROUP BY, a scalar subquery and OVER on one small table, adds PARTITION BY and a share of the total, and then combines GROUP BY with OVER. Every result comes from SQL Server 2025.

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
Biscuit joiner set against one timber joint beside an untouched matching joint

QUERY_OPTIMIZER_HOTFIXES: Turning On Optimizer Fixes per Database

February 24, 2013
Pinal Dave
SQL Performance
SQL Performance, SQL Scripts, SQL Server

A vendor says to turn on optimizer hotfixes. Here is how I check the setting, try it on one statement, and restore it.

Read More
A kitchen cupboard crammed with unmatched container lids, a red one at the front.

Finding Orphaned Data and Log Files Nobody Attached

February 23, 2013
Pinal Dave
SQL Tips and Tricks
DBA, Disk, SQL Data Storage, SQL Server

Inventory orphaned data and log files by comparing data-folder contents with sys.master_files, then review candidates before cleanup.

Read More
A netted fruit cage over blackcurrant bushes, a blackbird perched outside unable to get in.

Safe Dynamic SQL With sp_executesql and QUOTENAME

February 19, 2013
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Server, SQL Server Security, SQL Stored Procedure

Write safe dynamic SQL with typed value parameters, validated object names, and allowed sort columns, then test hostile input.

Read More
SQL SERVER - Fix : Error - sqljdbc_auth.dll Issue - com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed

SQL SERVER – Fix : Error – sqljdbc_auth.dll Issue – com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed

February 17, 2013
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Server

A JDBC user got ‘The TCP/IP connection to the host localhost, port 1433 has failed’ even after checking the firewall. Here is the sqljdbc_auth.dll fix.

Read More
A row of garden gates swinging free, one red gate still latched

Optimized Locking in SQL Server 2025: What Changes for Blocking

February 15, 2013
Pinal Dave
SQL Performance
SQL Lock, SQL Performance, SQL Server, Transaction Isolation

Enable optimized locking in SQL Server 2025 with ADR and RCSI, then compare lock counts and blocking while checking LAQ limits.

Read More
Previous 1 … 273 274 275 276 277 278 279 … 416 Next
  • Books
  • Testimonials
  • Privacy Policy

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