Who should own the database?
TL;DR; SA, or if you are really paranoid then you can create a disabled SQL login with minimal permissions and...
2018-01-25 (first published: 2018-01-15)
2,718 reads
TL;DR; SA, or if you are really paranoid then you can create a disabled SQL login with minimal permissions and...
2018-01-25 (first published: 2018-01-15)
2,718 reads
Currently the only way to rename objects in SQL Server is to use sp_rename. Although that may be changing in...
2018-01-11
1,571 reads
It’s the first T-SQL Tuesday of the year! Arun Sirpal (b/t) is our host this month. Thanks, Arun! The subject...
2018-01-09
309 reads
It’s a new year and yet education never ends. So this month let’s take a look at an important part...
2018-01-10 (first published: 2018-01-03)
2,502 reads
I was doing some research on impersonation the other day, and among other things, I ran across a forum question...
2017-12-27
800 reads
Happy holidays everyone! Ok, this isn’t even remotely related to SQL Server but it sounded fun. I found someone playing...
2017-12-20
974 reads
tl;dr: When using a windows or active directory authenticated id you do not put the username or password into your...
2017-12-18
716 reads
One of the really cool things about the cloud is how quickly you can spin up a new machine to...
2017-12-14
535 reads
T-SQL Tuesday. Each month a different blogger hosts Adam Machanic’s (b/t) blog party. The host comes up with a topic...
2018-01-01 (first published: 2017-12-12)
1,699 reads
SQL Server login ids may not be the most secure thing in the world but they are likely to be...
2017-12-18 (first published: 2017-12-06)
1,728 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