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: a deep stone well with one wooden bucket lowered on its rope, the rope tied off with a vermilion knot, while two empty buckets wait in a line on the well rim behind it

sys.dm_os_waiting_tasks: Who Is Waiting Right Now and Why

November 23, 2012
Pinal Dave
SQL Performance
SQL DMV, SQL Lock, SQL Monitoring, SQL Wait Stats

sys.dm_os_waiting_tasks shows every task that waits right now, what it waits for and who is in the way. This post builds a three-session blocking chain on SQL Server 2025, reads the view, finds the head of the chain and names the locked table.

Read More
SQL SERVER - Removing Leading Zeros From Column in Table - Part 2

SQL SERVER – Removing Leading Zeros From Column in Table – Part 2

November 22, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function

Part 2 on removing leading zeros from column values: readers improved my sample with all-zero values and shared better methods, collected here.

Read More
Gouache painting of two shelves holding the same three jars in opposite orders, the short jar on the top shelf painted red

Display Datetime in a Specific Format: CONVERT and FORMAT

November 21, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL String

To display datetime in a specific format, use CONVERT with a style number or FORMAT with a pattern. This post tests both on a fixed value, shows the lowercase pattern mistake, measures how much slower FORMAT is, and explains why parsing text dates needs a style.

Read More
SQL SERVER - Using RAND() in User Defined Functions (UDF)

SQL SERVER – Using RAND() in User Defined Functions (UDF)

November 20, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

Using RAND() in a user defined function throws Msg 443, invalid use of a side-effecting operator. Here is a simple workaround that lets a UDF use a random value.

Read More
SQL SERVER - Removing Leading Zeros From Column in Table

SQL SERVER – Removing Leading Zeros From Column in Table

November 19, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

Most people ask how to keep leading zeros in SQL Server. This time a reader wanted to remove leading zeros and white space from a column, so here is a script.

Read More
A line of falling wooden dominoes on a floor, with one red domino turned sideways to stop the chain.

Automating SQL Server Patching With PowerShell

November 18, 2012
Pinal Dave
SQL Tips and Tricks
Cumulative Update, PowerShell, SQL Patch, SQL Server, SQL Setup

Automating SQL Server Patching with PowerShell means staging a verified package, running Setup quietly, checking logs, and stopping on failure.

Read More
A packed crate of film cans on a doorstep, the projector with its red strap left behind.

Restoring a TDE Protected Database on Another Server

November 17, 2012
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL Server, SQL Server Encryption, SQL Server Security

Restore a TDE protected database on another SQL Server by moving its certificate and private key, then verify encryption state.

Read More
Previous 1 … 507 508 509 510 511 512 513 … 841 Next
  • Books
  • Testimonials
  • Privacy Policy

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