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 garden bed with many small seedlings and a wicker basket holding pulled ones

DROP STATISTICS Script: Remove Auto-Created Statistics

February 4, 2020
Pinal Dave
SQL Tips and Tricks
SQL DMV, SQL Scripts, SQL Statistics, SQL System Table

A DROP STATISTICS script can remove every auto-created statistic in a database, and SQL Server builds the useful ones again on demand. This post previews the statements, runs them behind a switch and shows what happens to the next query. It also says when the cleanup helps.

Read More
A flock gathered at a gate gives a concrete scene for counting a collection

What are Different Methods to Know the Row Count of Table? – Interview Question of the Week #261

January 26, 2020
Pinal Dave
SQL Interview Questions and Answers
SQL Counter, SQL DMV, SQL Scripts, SQL Server, SQL Server Management Studio, SQL System Table

Question: What are Different Methods to Know the Row Count of Table? The answer to this question is very simple and many.

Read More
Gouache painting of a vegetable bed divided into five sections with a vermilion watering can on one divider

Get Partition Info in SQL Server: Rows and Boundaries

September 24, 2019
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL System Table, Table Partitioning

To get partition info in SQL Server, join sys.partitions to the partition scheme, function and filegroup views. This post builds a small partitioned table, lists every partition with its boundaries, row count and filegroup, and shows how to find the partition for a value. It also lists the tables that have more than one partition.

Read More
Gouache painting of six small tins on a sewing table, three open with buttons and a vermilion magnifying glass in front

Tables Containing a Column: Search by Name in SQL Server

September 9, 2019
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Scripts, SQL Server, SQL System Table

To find tables containing a column, search sys.columns by name instead of opening tables one by one. This post searches one database, then every database on the server, and shows why an underscore in the pattern needs brackets. It also compares the data types of related columns.

Read More
A garden path of alternating cream and blue slabs from a red slab at the gate, one slab missing by a tree root

A Schedule Table That Repeats Every Other Week

September 2, 2019
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Build an every other week schedule in T-SQL, skip holiday dates, find the next occurrence, and check rota weeks from one anchor.

Read More
Loose tiles are combined into a finished tiled surface

How to Find Definition of Computed Column in SQL Server using T-SQL? – Interview Question of the Week #233

July 14, 2019
Pinal Dave
SQL Interview Questions and Answers
Computed Column, SQL Function, SQL Server, SQL System Table

Question: How to Find Definition of Computed Column in SQL Server using T-SQL?
Answer: A very fair question, I received the other day.

Read More
Gouache painting of two matching teapots wearing each other's lids, one lid vermilion

Logical Name Mismatch: master_files vs database_files

July 8, 2019
Pinal Dave
SQL Tips and Tricks
AlwaysOn, SQL DMV, SQL Error Messages, SQL System Table

A logical name mismatch means sys.master_files and sys.database_files disagree about a file name. A tested demo shows both views on one server, and a script checks every database. The post explains the secondary replica case and its fix.

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

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