Need the current database name in a script? SELECT DB_NAME() returns the name of the database you are running the query in. It is a one line answer.
SQL Server emergency? Email pinal@sqlauthority.com with URGENT in the subject line.
SQL SERVER – 2005 – Find Unused Indexes of Current Database
A simple but accurate SQL Server 2005 script to find unused indexes in the current database, since unused indexes slow down INSERT and UPDATE statements.
Weighted Scores: Ranking Products by Several Columns at Once
Adding rating to units sold ranks by whichever column is biggest. Scale first, weigh second, and keep the weights in a table anyone can read.
Reading Memory Clerks to See Where Memory Goes
Memory clerks show how SQL Server allocates memory among engine components; learn to read the DMV, spot unusual growth, and investigate safely.
NULL Sort Order: Put Missing Values Where Readers Expect
NULL sort order uses a CASE bucket to put missing values last. Keep a stable tie breaker and preserve the original score.
CHAR: Invalid Character Codes Return NULL
CHAR constructs a character instead of printing an integer. Preserve byte-code inputs and distinguish an ordinary space from missing output.
SQL SERVER – Import CSV File Into SQL Server Using Bulk Insert – Load Comma Delimited File Into SQL Server
How to import CSV file data into SQL Server with BULK INSERT: create a table, point to the comma delimited file and load every row in a few quick steps.
SQL Server slow? Let's fix it together in about four hours.
In my Comprehensive Database Performance Health Check, you share your screen, I guide you, and we fix your biggest performance troublemakers. No passwords. No remote access.
You keep every script, and the know-how to fix it yourself next time.
Want your whole team to learn it?
My Practical Workshop has no PowerPoint, just live demos. My AI Enablement Workshop shows your team where AI saves hours, and where it quietly costs them.
Over 400 customers have worked with me this way, and not one shared a password. See all consulting options.
Who We Are
Pinal Dave is an SQL Server Performance Tuning Expert and independent consultant with over 24 years of hands-on experience. He holds a Masters of Science degree and numerous database certifications.
Pinal has authored 19 books and 125 Pluralsight courses. To freely share his knowledge and help others build their expertise, Pinal has also written more than 5,800 database tech articles on his blog at https://blog.sqlauthority.com.
Pinal is also a CrossFit Level 1 Trainer (CF-L1) and CrossFit Level 2 Trainer (CF-L2).
Nupur Dave is a social media enthusiast and an independent consultant. She primarily focuses on the database domain, helping clients build short and long-term multi-channel campaigns to drive leads for their sales pipeline.
Shaivi Pinalkumar Dave is a book author and a women’s artistic gymnast.

