An Alternative to SELECT COUNT(*) for Better Performance
Sometimes rapid code development doesn't always produce the most efficient code. Take the age old line of code SELECT COUNT(*)...
2013-05-07
5,299 reads
Sometimes rapid code development doesn't always produce the most efficient code. Take the age old line of code SELECT COUNT(*)...
2013-05-07
5,299 reads
Here is the May 2013 version of my SQL Server 2008 R2 Diagnostic Information Queries, with some minor tweaks and...
2013-05-07
754 reads
Here is the May 2013 version of my SQL Server 2012 Diagnostic Information Queries, with some minor tweaks and improvements...
2013-05-07
764 reads
One of the Microsoft’s recommendation for optimizing the tempDB performance is to make each tempdb data file the same size. Today,...
2013-05-06
947 reads
It’s the start of the month of May, or at least the first Monday in May. Hopefully you aren’t nursing...
2013-05-06
693 reads
I am pleased to be selected to present a session on Analysis Services at the Atlanta SQLSaturday this May 18th...
2013-05-06
555 reads
One of my authors sent me this note:
“
I know you only know me as a writer for SQLServerCentral, but I...
2013-05-06
701 reads
This is going to be a simplest way of capturing and sending some useful information via an email of ‘N’...
2013-05-06
758 reads
For those that follow me on twitter (@StrateSQL), you’ll know that throughout the day I tweet out some links of...
2013-05-06
431 reads
I’ve been getting a funky error with a new Powershell script, running as a SQL Agent job step. Let’s pretend for the...
2013-05-06
765 reads
By Steve Jones
This is timely, as I’m currently on a boat in the Adriatic taking a...
You can find the slides and SQL scripts for my session “Spice up your...
By SQLPals
How to Clear the SSMS Cache (SSMS 21 and Later) Updated...
Comments posted to this topic are about the item Using CHOOSE()
Comments posted to this topic are about the item Re-Seeding a Broken Log Shipping...
Comments posted to this topic are about the item The DBA is Dead! Long...
We have this code that sets some status values and then queries them using the CHOOSE() function in SQL Server 2025.
CREATE TABLE Status
(
StatusID INT,
StatusDescription VARCHAR(20)
);
GO
INSERT dbo.Status
(
StatusID,
StatusDescription
)
VALUES
(0, 'Uncategorized'),
(1, 'Active'),
(2, 'Inactive'),
(3, 'Temp');
GO
SELECT CHOOSE(StatusID, 'Unknown', 'Active', 'Inactive', 'Temporary')
FROM Status;
When the SELECT runs, what is returned? See possible answers