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
Temporary luggage rests in designated storage spaces on a shelf

Where is Table Variable Created? – Interview Question of the Week #243

September 22, 2019
Pinal Dave
SQL Interview Questions and Answers
Disk, SQL Scripts, SQL Server, SQL TempDB, Temp Table

Question: Where is Table Variable Created?

Answer: On Hard Disk and NOT in Memory.

I suggest you read the following blogs

Read More
Illustrated cover: Temp Table Logging

SQL SERVER – Regular Table or Temp Table – TempDB Logging Explained

September 20, 2019
Pinal Dave
SQL Performance
SQL Scripts, SQL Server, SQL TempDB, Temp Table, Transaction Log

After the blog posts about temp and regular table, I have received questions about it hence I am writing this blog post about TempDB Logging.

Read More
Gouache painting of a garden hose with a kink held by a vermilion clip and a sputtering sprinkler beyond

Query Runs Slow Occasionally: Five Checks to Find Why

September 7, 2019
Pinal Dave
SQL Performance
Maintenance Plan, SQL Lock, SQL Scripts, SQL TempDB, SQL Wait Stats

When a query runs slow occasionally, the cause sits around the query: a lock, a job, a file growth, tempdb or a shortage of worker threads. This post gives one tested T-SQL check for each and a small demo for blocking and file growth. It also says what to do when all five checks find nothing.

Read More
Gouache painting of a shelf with one vermilion bucket and four more stacked aside

Remove Extra tempdb Files in SQL Server Safely

August 19, 2019
Pinal Dave
SQL Performance
SQL Scripts, SQL Server, SQL Server DBCC, SQL TempDB

To remove extra tempdb files, empty each file first with DBCC SHRINKFILE and then remove it with ALTER DATABASE. This post checks the file count and the allocation waits before you start, rehearses both steps on a demo database, shows the tempdb statements with their undo, and explains why emptying can fail.

Read More
Gouache painting of a huge stockpot with a little soup beside a smaller pot with a vermilion lid

Shrink tempdb Without Restarting SQL Server

August 15, 2019
Pinal Dave
SQL Tips and Tricks
Shrinking Database, SQL Scripts, SQL Server DBCC, SQL TempDB

To shrink tempdb without a restart, run DBCC SHRINKFILE against each tempdb file with a target size in megabytes. This post checks the file sizes and the space use first, shows the statement with its undo, and tests the shrink rules on a demo database, so the tempdb server stays untouched.

Read More
Gouache painting of a small drawer cabinet on a sewing table with a vermilion thread spool inside one open drawer

Temp Table Scope in Dynamic SQL: Who Can See What

July 22, 2019
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Scripts, SQL TempDB, Temp Table

Temp table scope decides what dynamic SQL and stored procedures can read. Tested demos show a child reading a parent table, a procedure that fails without it, a dynamic table shape and the error a typo causes. A card lists the rules.

Read More
Gouache painting of a long vermilion fruit bowl in a market aisle with small private baskets under the counter

Dynamic SQL Temp Table: Why It Disappears and How to Keep It

July 20, 2019
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Scripts, SQL TempDB, Temp Table

A dynamic SQL temp table is dropped when its dynamic batch ends, so the main code cannot read it. A global temp table keeps the data, and a per session name keeps it safe. Every step is tested, including the second session clash.

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

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