Dates and Times in SQL Server: DATEDIFF() and DATEDIFF_BIG()
Last time we looked at adding or subtracting date parts using the DATEADD() T-SQL system function. This week we see...
2018-11-21
388 reads
Last time we looked at adding or subtracting date parts using the DATEADD() T-SQL system function. This week we see...
2018-11-21
388 reads
There has never been a better time to start a project to champion data privacy In a recent Harris poll sponsored by the payment company Stripe, over 1,000 C-level...
2018-11-21
19 reads
Shadow IT has been, well, maybe not the bane of the IT department, but certainly a pain in the neck....
2018-11-21
940 reads
Please join the Power BI User Community in Dallas on Nov 27th through the 29th for the Power BI World Tour. There will be a one-day workshop on Tuesday...
2018-11-20
28 reads
Knowing just how long an event takes is a common requirement when troubleshooting. Sometimes, figuring out the unit of time is a bit troublesome. Is it milliseconds, seconds or...
2018-11-20
16 reads
Knowing just how long an event takes is a common requirement when troubleshooting. Sometimes, figuring out the unit of time...
2018-11-20
255 reads
I ran into an interesting problem while working with the POWER() function. I was trying to do some binary conversions...
2018-11-20
815 reads
Ever want to confirm that a port is accessible from one computer to another? There’s a PowerShell cmdlet for that, Test-NetConnection. With the -Port option, this cmdlet will do...
2018-11-20
89 reads
Ever want to confirm that a port is accessible from one computer to another? There’s a PowerShell cmdlet for that,...
2018-11-20
7,030 reads
What were you thinking?
Have you ever been working on some code from another person, and you end up scratching your...
2018-12-05 (first published: 2018-11-20)
2,257 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