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
Gouache painting of a stone staircase descending into a sunken orchard corner with the first step painted red

Negative Identity Seed and Negative Increment in SQL Server

August 19, 2010
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Identity, SQL Scripts

A Negative Identity seed lets a column start below zero, and a negative increment makes it count down. This post tests IDENTITY(-1,-1) and IDENTITY(-2147483648,1) on SQL Server 2025, shows gaps after a rollback, DBCC CHECKIDENT, and what to do when an int identity runs out. It also shows SEQUENCE as the flexible alternative.

Read More
Three terracotta bowls, one empty, beside a blue tray with three circular recesses.

CROSS APPLY Aggregate: An Empty Input Can Still Return a Row

August 18, 2010
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Joins, SQL Scripts, SQL Server

CROSS APPLY aggregate behavior depends on whether the right-side query actually produces a row. I inspect that query before assuming unmatched customers disappear. An aggregate without GROUP BY can return a row even when its input is empty.

Read More
SQL SERVER - Finding the Occurrence of Character in String

SQL SERVER – Finding the Occurrence of Character in String

August 16, 2010
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL String

A quick T-SQL method using LEN and REPLACE to count the occurrence of character or word in a string, written as a hint for TSQL Beginners Challenge 14.

Read More
Gouache painting: on a floured board, one long strand of fresh pasta on the left is folded into a V with a doubled-back spike through its middle, overlapping itself

geometry MakeValid: Repair Can Change the Geometry Type

August 14, 2010
Pinal Dave
SQL Tips and Tricks
Spatial Database, SQL Function, SQL Scripts, SQL Server

geometry MakeValid returns a valid geometry from an invalid instance, but the result can change type. I keep the original beside the proposed repair. A validity flag alone does not describe everything that changed.

Read More
Execution plan with and without index.

SQL SERVER – Computed Column and Performance – Part 3

August 13, 2010
Pinal Dave
SQL Performance
SQL Index, SQL Scripts

Part 3 of my series on computed column and performance shows how an index improves the performance of a computed column. Read the earlier parts first.

Read More
SQL SERVER – SHRINKDATABASE For Every Database in the SQL Server

SQL SERVER – SHRINKDATABASE For Every Database in the SQL Server

August 12, 2010
Pinal Dave
SQL Performance
DBA, SQL Scripts

A query tuning visit turned into a lesson on why running SHRINKDATABASE for every database is a bad idea. Here is what happened at the client’s office.

Read More
Execution plan diagram showing parallelism and cost percentages.

SQL SERVER – Parallelism Query in Database

August 6, 2010
Pinal Dave
SQL Tips and Tricks
SQL Scripts

Feodor asked how to get a parallelism query plan on a dual core computer using AdventureWorks. Here is the T-SQL I used to reproduce a parallel plan.

Read More
Previous 1 … 253 254 255 256 257 258 259 … 365 Next
  • Books
  • Testimonials
  • Privacy Policy

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