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 child's handprint set hard in a concrete square by a back door, a garden trowel lying useless beside it.

Immutable Backups: Keeping a Copy Ransomware Cannot Delete

August 20, 2019
Pinal Dave
SQL Tips and Tricks
DBA, SQL Backup and Restore, SQL Server, SQL Server Security

Design immutable backups with enforced retention, separate storage access, offline recovery material, checksum checks, and restore tests.

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
A carved template produces the same pattern on several new clay tiles

How to Create a Table Automatically in All Newly Created Databases? – Interview Question of the Week #238

August 18, 2019
Pinal Dave
SQL Interview Questions and Answers
SQL Scripts, SQL Server, System Database

Question: How to Create a Table Automatically in All Newly Created Databases? This question was recently asked in my recent consulting engagement

Read More
Gouache painting of a small tower of round, square and triangular wooden blocks topped with a vermilion block

DATETIMEFROMPARTS Function: Build Dates From Parts

August 17, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

The DATETIMEFROMPARTS function builds a datetime value from seven numbers, with no string conversion and no language trap. This post tests how it rounds milliseconds, which parts raise an error, how it treats NULL, and how its relatives build dates, times and offsets.

Read More
Gouache painting of wheelbarrows of apples waiting in line at one apple press with the first barrow in vermilion

Runnable Sessions in SQL Server: What to Check Next

August 16, 2019
Pinal Dave
SQL Performance
SQL CPU, SQL DMV, SQL Scripts, SQL Server

Runnable sessions are sessions that have everything they need except a free CPU. This post counts requests by status, checks that SQL Server can see every processor, reads the settings that cap CPU use, and lists the statements waiting in the queue, so a long queue next to a half idle CPU stops being a puzzle.

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 wall of small drawers with one pulled open showing a vermilion key

Show Primary Key of a Table in SQL Server With sp_pkeys

August 14, 2019
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts, SQL Stored Procedure, System Object

To show primary key columns for one table, call sp_pkeys with the table name. This post builds a small demo database, reads a single column and a composite key, and handles schemas and errors. It also lists every key in a database with one catalog query.

Read More
Previous 1 … 149 150 151 152 153 154 155 … 843 Next
  • Books
  • Testimonials
  • Privacy Policy

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