StraightforwardSQL

Blog Post

KDA: Echoes of Deception - Case 3

The crime spree in Digitown is not ending. This time 20 cars have been stolen and we need to find where they’re stored.
The problem
This is the abridged case description....

2025-06-09 (first published: )

262 reads

Blog Post

KDA: Echoes of Deception - Case 2

The people of Digitown are being targeted by phishermen, and they need my help to stop them in their tracks.
The problem

The police have asked for our assistance, and we’ve...

2025-06-02 (first published: )

188 reads

Blog Post

KDA: Echoes of Deception - Case 1

Another KDA case: Digitown’s utility bills suddenly doubled for no good reason. With the election coming up, I got pulled in to figure out what went wrong. I’ve got...

2025-05-30 (first published: )

191 reads

Blog Post

Kusto Detective Agency - Intro

While I mostly write about SQL Server, I have a soft spot for Kusto. In this series, I will explore solutions to fun challenges collectively known as the Kusto...

2025-04-27 (first published: )

77 reads

Blog Post

Deploy at Low Priority

Learn how to deploy schema changes in an always-online SQL Server environment without a maintenance window. This utility reduces blocking and improves deployment success.
The problem
I attempted to deploy a...

2025-03-19 (first published: )

188 reads

Blog Post

Finding nested references

I originally planned this post just as an answer to DBA Stack Overflow question: How can I get the list of tables in all the stored procedure? After preparing...

2024-09-13 (first published: )

257 reads

Blog Post

Service Broker Blocking

This post is dedicated to all 10 other DBAs that use Service Broker (you know who you are).
The main reason for this blog post is that I’ve got no...

2024-08-19 (first published: )

170 reads

Blogs

PASS Data Community Summit LinkedIn Contest

By

If you're not having success in convincing your organization to send you to this...

Boost SQL Server Security with gMSA: Real-World Examples & PowerShell Scripts

By

When deploying SQL Server in enterprise environments, choosing the right service account model is...

Andreas Wolter on Evading Data Access Auditing

By

There are always bad actors who will seek to get access to and, likely,...

Read the latest Blogs

Forums

Determining the Updated Columns

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Determining the Updated Columns

Carrots and Sticks

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Carrots and Sticks

Replace with like join

By James Bosco

I am trying to create and Update query based on a like join.  Is...

Visit the forum

Question of the Day

Determining the Updated Columns

I am creating a trigger in SQL Server 2022 and want to detect a change in a table. Here is my table DDL:

CREATE TABLE CustomerLarge (
 CustomerID INT NOT NULL IDENTITY(1,1) CONSTRAINT CustomerLargePK PRIMARY KEY CLUSTERED
 , CustomerName VARCHAR(20)
 , CustomerContactFirstName VARCHAR(40)
 , CustomerContactLastName VARCHAR(40)
 , Address VARCHAR(20)
 , Address2 VARCHAR(20)
 , City VARCHAR(20)
 , CountryCode CHAR(3)
 , Postal VARCHAR(20)
 , creditlimit INT
 , discount numeric(4,2)
 , lastorderdate DATETIME
 , lastorderamount NUMERIC(10,2)
 , lastordercontact VARCHAR(20)
 , created DATETIME
 , modified DATETIME
 , modifiedby VARCHAR(20)
 , statusid INT
 , active BIT
 , customersize INT
 , primarysalesid INT)
 GO
If I want to detect that the creditlimit was updated, what IF statements should I use?

See possible answers