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
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
Gouache painting of six clay pots on a potting bench, five tipped over and empty, one upright vermilion pot

Drop Tables by Prefix in SQL Server and Azure SQL Database

June 21, 2019
Pinal Dave
SQL Tips and Tricks
SQL Azure, SQL Cursor, SQL Scripts, SQL Table Operation

To drop tables by prefix, list the matching tables first and drop them with a script that quotes every schema and table name. This post shows why the underscore in a prefix is a trap, a one-statement version and a cursor version. It works in SQL Server and in Azure SQL Database.

Read More
An empty park bench under falling blossoms shows why appearance alone cannot establish its last use

When was Table Accessed Last By User? – Interview Question of the Week #226

May 26, 2019
Pinal Dave
SQL Interview Questions and Answers
SQL DMV, SQL Index, SQL Scripts, SQL Server, SQL Table Operation

When was a table accessed last by a user? When clients say a table is rarely used, I run this report to check before we create or drop indexes.

Read More
Each sample group is compared with its own local measuring jig.

SQL SERVER – How to Write Correlated Subquery?

December 21, 2018
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Table Operation

A Correlated Subquery references the outer query. I use a stock-item comparison after the earlier single-table aggregate lesson.

Read More
An empty sewing tin stands beside many thread spools that have not been placed inside it

How to Create an Empty Table and Fool Optimizer to Believe It Contains Data? – Interview Question of the Week #204

December 16, 2018
Pinal Dave
SQL Interview Questions and Answers
SQL Performance, SQL Scripts, SQL Server, SQL Statistics, SQL Table Operation

How do you create an empty table and fool the optimizer into thinking it has data? Nobody asked me that in 20 years, but I use this trick in Health Checks.

Read More
Gouache painting of a vermilion cart carrying three small stacked wooden tables

Drop Multiple Tables with One DROP TABLE Statement

October 23, 2018
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts, SQL Table Operation

To drop multiple tables in SQL Server, list them in one DROP TABLE statement, referencing tables first. This post tests the order rule on a parent and child table and shows what happens after an error. It also covers IF EXISTS, drops by name pattern and temporary tables.

Read More
A shoulder yoke carrying one bucket of stones while a second load waits beside it

Disk Space Needed to Build a Clustered Index on a Big Table

April 11, 2018
Pinal Dave
SQL Performance
Clustered Index, SQL Table Operation, Table Partitioning, Temp Table

A clustered index build holds the old table and the new index at the same time. Here is a small demo of that peak, and what to check first.

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

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