Code I’d Hate To Live Without: T-SQL Tuesday #104
It’s TSQL Tuesday again! This time our respected host is Bert Wagner (b/t). Quick aside, if you haven’t seen his...
2018-07-19 (first published: 2018-07-10)
3,647 reads
It’s TSQL Tuesday again! This time our respected host is Bert Wagner (b/t). Quick aside, if you haven’t seen his...
2018-07-19 (first published: 2018-07-10)
3,647 reads
For this month’s homework let’s try something a bit different. SQL Agent jobs are a very powerful tool frequently used...
2018-07-13 (first published: 2018-07-02)
2,017 reads
I thought for the end of the month it would be fun to do another T-SQL Puzzle. In this case...
2018-07-04 (first published: 2018-06-27)
2,174 reads
When I think of the public role I often think of the guest database principal (user) at the same time....
2018-06-25
292 reads
A common mistake, and one I make frequently myself is to use a string in place of an identifier, or...
2018-07-02 (first published: 2018-06-20)
3,410 reads
In general, the errors SQL gives are highly useful. Of course every now and again you get one that’s just...
2018-06-18
802 reads
tl;dr; When doing an insert across a linked server you have to include the list of fields to be inserted...
2018-06-14
551 reads
For this month’s t-sql Tuesday our host Bjoern Peters (b/t) wants us to describe our experiences with Azure SQL Database...
2018-06-22 (first published: 2018-06-12)
2,402 reads
Monday Grant Fritchey (b/t) put up a great post EXTENDED EVENTS, THE SYSTEM_HEALTH SESSION, AND WAITS that talks about how...
2018-06-14 (first published: 2018-06-06)
2,688 reads
Here we are again. The beginning of another month. At the beginning of each month I put out a SQL...
2018-06-04
244 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