Using @@ROWCOUNT can be a bit tricky
@@ROWCOUNT is a very useful system variable that returns the number of rows read/affected by the previous statement. It’s frequently...
2015-09-16
725 reads
@@ROWCOUNT is a very useful system variable that returns the number of rows read/affected by the previous statement. It’s frequently...
2015-09-16
725 reads
Figuring out what components of SQL Server are installed on a particular machine has always been a task that has...
2015-09-14
632 reads
The other day I was asked to tune a stored procedure. Not exactly an uncommon task, but I worked something...
2015-09-22 (first published: 2015-09-10)
4,875 reads
This T-SQL Tuesday we are hosted by one of the DBA’s of the night: Jen McCown (b/t). She want’s us...
2015-09-11 (first published: 2015-09-08)
1,864 reads
I’m a regular watcher of the Midnight DBA Webshow and one day they mentioned regular expressions. Not a new term...
2015-09-02
963 reads
The default instance actually has an instance name. It’s MSSQLSERVER. This is probably familiar to a lot of you but...
2015-09-07 (first published: 2015-08-31)
3,281 reads
In one of my first IT jobs (back in the dark ages) we had something called the thirty minute rule....
2015-08-26
672 reads
The tail of the log
A little while back I was feeling overwhelmed by the number of blog posts ideas that...
2015-08-24
654 reads
The other day Richie Rump (b/t) mentioned something called a clipboard manager on twitter. I’ll admit I had to ask...
2015-08-28 (first published: 2015-08-19)
2,823 reads
The other day I was asked to pull a list of errors from the SQL Server log into a table...
2015-08-25 (first published: 2015-08-17)
3,461 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