Code examples : T-SQL Tuesday #143
It’s TSQL Tuesday! John Armando McCormack (blog|twitter) is our host this month and he’d like us to share some of ... Continue reading
2021-10-12
43 reads
It’s TSQL Tuesday! John Armando McCormack (blog|twitter) is our host this month and he’d like us to share some of ... Continue reading
2021-10-12
43 reads
Deleting rows from a table is a pretty simple task right? Not always. Foreign keys, while providing a ton of ... Continue reading
2021-10-07
121 reads
Here are some really common questions I get: How many CPUs does ServerA have? How much memory does ServerA have? ... Continue reading
2021-10-05
72 reads
CREATE DATABASE [Story]
ON PRIMARY
( NAME = N'Story', FILENAME = N'C:DataStory.mdf',SIZE = 101MB),
FILEGROUP [Line1]
( NAME = N'File1', FILENAME = N'C:Data_.It',SIZE = 102MB),
( NAME =...
2021-10-18 (first published: 2021-09-30)
520 reads
One of the easiest ways to collect information about table activity is to add a series of audit columns to ... Continue reading
2021-10-11 (first published: 2021-09-28)
523 reads
In my last post I talked about invoke-sqlcmd. It’s a nice easy way to run a query or a .sql ... Continue reading
2021-10-04 (first published: 2021-09-21)
637 reads
As with all programming tasks there are a number of ways to do something, this is just one that I ... Continue reading
2021-09-27 (first published: 2021-09-16)
561 reads
Quick query today. I needed a list of database sizes so came up with this: Nothing exciting, but I figure ... Continue reading
2021-09-22 (first published: 2021-09-14)
449 reads
One of the things I hate most about using remote desktop is when the resolution for the remote server is ... Continue reading
2021-09-09
63 reads
I’m going to be fairly high level on these because to be honest, if you are going to use them ... Continue reading
2021-09-07
87 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...
Telp/Wa 628218200203 Gedung Sutrado, Jl. Kenari 2 No.5 Lt. 1, RT.2/RW.3, Kenari, Kec. Senen,...
Telp/Wa 628218200203 Jl. Biak No.44 AB, RT.8/RW.11, Cideng, Kecamatan Gambir, Kota Jakarta Pusat, Daerah...
Telp/Wa 628217555651 Gedung Plaza Bank Index Ground, Jl. M.H. Thamrin No.57 Floor Suite GF-21,...
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