Filtering Object Explorer
I absolutely love learning new tricks that can be done in SSMS. Everything from opening initial connections to both the...
2013-10-02
900 reads
I absolutely love learning new tricks that can be done in SSMS. Everything from opening initial connections to both the...
2013-10-02
900 reads
In my general quest to figure out the T-SQL to do common GUI tasks I did some browsing through BOL...
2013-10-01 (first published: 2013-09-26)
1,667 reads
What the heck? Even indexes have WHERE clauses these days. I can’t remember what I was reading when I saw...
2013-09-30
1,368 reads
Recently I wrote about the myth that you can’t use an alias in an UPDATE statement. You can of course,...
2013-09-24
890 reads
Last month I posted my stored procedures sp_SrvPermissions and sp_DBPermissions. I’m posting V2.0 of each with a few fixes. The...
2013-09-23 (first published: 2013-09-18)
2,467 reads
Last month I posted my stored procedures sp_SrvPermissions and sp_DBPermissions. I’m posting V2.0 of each with a few fixes. The...
2013-09-23 (first published: 2013-09-18)
2,095 reads
This is possibly the best blog I have every read on the subject of reviewing a database. It is witty,...
2013-09-17
712 reads
I’ve found a very common belief among users of T-SQL (both DBAs and Developers) is that you can’t use an...
2013-09-16
895 reads
Since Microsoft decided to drop the MCM/MCA program there has been an enormous amount of discussion about the program and...
2013-09-11
555 reads
I recently asked what the difference is between granting SELECT to a user (at a database level) and adding the...
2013-09-09
1,043 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