Saving and restoring session options settings
There are a fair number of options settings. ANSI_NULLS, ARITHABORT, QUOTED_IDENTIFIER, etc. Each session has its own set of configurations....
2017-09-25
496 reads
There are a fair number of options settings. ANSI_NULLS, ARITHABORT, QUOTED_IDENTIFIER, etc. Each session has its own set of configurations....
2017-09-25
496 reads
I told you not to use NOLOCK even though I use it sometimes.I told you not to shrink databases, even...
2017-09-20
440 reads
tl;dr; The uniquifier is used to make a non-unique key in a clustered index unique.
Uniquifier is a rather funny name,...
2017-09-22 (first published: 2017-09-18)
1,661 reads
Said no one ever. Well, maybe. I have had occasions where I needed a brief pause in the middle of...
2017-09-20 (first published: 2017-09-14)
3,255 reads
T-SQL Tuesday has rolled up on us yet again. This month it’s Rob Sewell’s (b/t) turn to host and picked...
2017-09-12
452 reads
Kendra Little (b/t) reminded me of this fun little trick (with fairly important ramifications) in her latest quiz on logical...
2017-09-07
668 reads
As I wrote my post about installing the latest version of SSDT I realized that my homework posts missed something...
2017-09-05
398 reads
I’d been trying to think of a fun post to write and an homage to Jeff Foxworth’s You might be...
2017-08-30
1,889 reads
A while back I did a post about creating an empty table using a SELECT statement. Basically doing something like...
2017-09-11 (first published: 2017-08-28)
3,097 reads
Of all of the annoying parts of SSIS, the major version sensitivity has to be the most annoying. Let’s say...
2017-09-06 (first published: 2017-08-23)
3,530 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