What is your why?: T-SQL Tuesday #111
This month Andy Leonard (b/t) wants to know why we do what we do. Funnily enough, this is something I...
2019-02-12
692 reads
This month Andy Leonard (b/t) wants to know why we do what we do. Funnily enough, this is something I...
2019-02-12
692 reads
The other day I talked about using Microsoft Learn. Well, honestly, Cloud Academy is the learning tool I’ve been using...
2019-02-06
221 reads
This homework series really has two purposes. It’s a primer for beginners. These are tasks I think most if not...
2019-02-04
208 reads
2019-01-30
244 reads
Indexes are probably the number one tool we have to improve performance. That said, there are times when we want...
2019-02-18 (first published: 2019-01-28)
2,469 reads
Of the different basic types of backups (full, differential and log) I find the differential the most interesting, and frequently...
2019-02-12 (first published: 2019-01-23)
2,166 reads
Sometimes you need a table that is read only. You don’t want anyone to be able to write to it...
2019-02-05 (first published: 2019-01-21)
2,675 reads
The other day I took a Microsoft Learn course about securing Azure SQL DB. It was really enjoyable and I...
2019-01-29 (first published: 2019-01-16)
2,253 reads
SQL Bits is almost here! It’s February 27th to March 2nd. SQL Bits is one of the most popular SQL...
2019-01-14
734 reads
Last July (yes, it’s taken me 5+ months to finally finish this) Steve Jones (b/t) suggested that it might be...
2019-01-10
179 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