TSQL Tuesday #84: Zip to Speaker
Well, it’s that time of the month again. It’s T-SQL Tuesday yet again, and this time round it’s Andy Yun (b/t)...
2016-11-08
466 reads
Well, it’s that time of the month again. It’s T-SQL Tuesday yet again, and this time round it’s Andy Yun (b/t)...
2016-11-08
466 reads
I saw something like this the other day. My first thought was “Hu, never seen that before.” My second thought...
2016-11-02
875 reads
DBA: Help me! Help me! It’s Halloween! I have a problem! Oh won’t you please help me!
Ok, so that’s really...
2016-11-07 (first published: 2016-10-31)
2,734 reads
As I write this we are packing to leave for Disney World, where my family and I will spend close...
2016-10-26
374 reads
You’ll hear these terms thrown around in programming all the time, but what do they mean and why do we...
2016-10-24
787 reads
For anyone who wasn’t aware SQLCMD is a command line tool for running T-SQL statements and scripts. Before anyone says...
2016-10-19
1,309 reads
A while ago I talked about Templates. This is an easy way to get a, well, template of a piece...
2016-10-17
477 reads
Indexes are great. They speed up our queries. In fact, without them relational database systems wouldn’t work.
Different indexes work best...
2016-10-13
602 reads
My friend Andy Mallon (b/t) is hosting T-SQL Tuesday this month. In case you aren’t aware T-SQL Tuesday is a...
2016-10-11
429 reads
I saw an interesting question today about rounding. Specifically they always wanted to round down. Now as it happens that...
2016-10-05
658 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