Tally Tables in T-SQL
The Tally (or Numbers) table is one of the most useful constructs in intermediate-level SQL. Have you ever written a...
2014-03-27
57,116 reads
The Tally (or Numbers) table is one of the most useful constructs in intermediate-level SQL. Have you ever written a...
2014-03-27
57,116 reads
If you’re like me, you might be thinking “I want some more things to think about when I migrate between...
2014-03-27
672 reads
TweetG’day,
I noticed something odd recently when looking at sys.dm_exec_requests. Specifically the system processes listed in that DMV – well at least...
2014-03-26
1,356 reads
We have Down Tools Week multiple times per year at Red Gate. This allows various employees to spend a week...
2014-03-26
4,180 reads
This walkthrough helps you to install Zap Business Intelligence. Some of you may need help knowing where to download the...
2014-03-26
970 reads
If my blog history is correct the last time I presented at oPASS was January 2012 – that seems like a...
2014-03-26
628 reads
We’ll be at OKC this summer for their SQL Saturday on August 23, and we’re presenting our precon “Becoming an...
2014-03-26
616 reads
My latest question The Unusable User is live today over at SQLServerCentral. It’s a three pointer, how is that for...
2014-03-26
694 reads
I had a recent run in with collation problems and it got me started reading. As I read I started...
2014-03-26
514 reads
I had a recent run in with collation problems and it got me started reading. As I read I started...
2014-04-02 (first published: 2014-03-26)
1,745 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