When Have You Used MOT Tables? T-SQL Tuesday #117
Steve Jones (b/t) is our host for T-SQL Tuesday and in case you didn’t know has taken over running T-SQL ... Continue reading
2019-08-13
229 reads
Steve Jones (b/t) is our host for T-SQL Tuesday and in case you didn’t know has taken over running T-SQL ... Continue reading
2019-08-13
229 reads
tl;dr; Temporary stored procedures are excellent for testing pieces of code that are going to go into (or come from) ... Continue reading
2019-08-21 (first published: 2019-08-07)
923 reads
Everything else aside two of the most important tasks of a database are to get data in, and get data ... Continue reading
2019-08-16 (first published: 2019-08-05)
328 reads
I did an interesting form of crossword recently and since I haven’t done one in a while I figured this ... Continue reading
2019-07-31
63 reads
If you are executing a stored procedure with a bunch of parameters it can be a bit of a pain ... Continue reading
2019-07-29
178 reads
I’m sure lots of you have used the function RAISERROR to handle an error caused by your code. The problem ... Continue reading
2019-07-24
44 reads
I have a lot of co-workers who use sp_who and sp_who2 to see who’s in a given database. This is ... Continue reading
2019-07-22
307 reads
When you think of system databases, tables, etc there are a number of things you might think of. Necessary to ... Continue reading
2019-08-07 (first published: 2019-07-17)
666 reads
The other day I did a post on how an OR short circuts. It was a somewhat unusual type of ... Continue reading
2019-08-06 (first published: 2019-07-15)
721 reads
Years ago I blogged about how I like to use the SSMS scripting feature to learn how to do things. ... Continue reading
2019-08-01 (first published: 2019-07-11)
873 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