Question: I ' m trying to get only the first date of the End Date changed from even if it's null. I did this, but I

I'm trying to get only the first date of the "End Date changed from" even if it's null. I did this, but I'm still getting additional numbers in some of my results. What am I doing wrong?
DROP TABLE #Store
CREATE TABLE #Store
(
[Description] varchar(250)
);
INSERT INTO #Store ([Description])
VALUES ('Store Pricing Plan #1111111 modified. End Date changed from NULL to 10/24/2024'),
('Store Pricing Plan #222222 modified. End Date changed from NULL to 04/30/2025'),
('Store Pricing Plan #333333 modified. Start Date changed from 09/16/2024 to 10/01/2024 End Date changed from 08/31/2025 to 09/30/2025 Store Pricing Plan changed from NULL to Store Plan')
SELECT
#Store.[Description],
SUBSTRING(#Store.[Description], NULLIF(CHARINDEX('End Date changed from ', #Store.[Description]),0)+ LEN('End Date changed from ')+1,10) 'End Date'
FROM #Store
I ' m trying to get only the first date of the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!