Question: I ' m trying to get only the ending number of the store limit . I did this, but I ' m still getting additional

I'm trying to get only the ending number of the store limit. I did this, but I'm still getting additional characters I don't want to include. How can I exclude them?
DROP TABLE #Store
CREATE TABLE #Store
(
[Description] varchar(250)
);
INSERT INTO #Store ([Description])
VALUES ('Store Pricing Plan #0000000 modified. Store Limit changed from NULL to 8610.0'),
('Store Pricing Plan #1111111 modified. Store Limit changed from NULL to 2620.0 Sotred Pricing Program changed from NULL to Sale Pro Plan'),
('Store Pricing Plan #2222222 modified. Store Price changed from 1.999000 to 1.819000 Store Limit changed from 15000.0000 to 5500.0asdfghj Plan Name'),
('Store Pricing Plan #3333333 modified. Store Limit changed from 32100.0000 to 123455.0'),
('Store Pricing Plan #4444444 modified. Store Limit changed from 941.0000 to 142.2 Money Limit changed from 1100.69 to 426.51'),
('Store Pricing Plan #5555555 added. Store Price: 2.60 date from 11/01/2024 to 10/31/2025')
SELECT
#Store.[Description],
CASE WHEN
CHARINDEX('Store Limit changed from ', #Store.[description])>0 AND CHARINDEX('to ', #Store.[Description], CHARINDEX('Store Limit changed from ', #Store.[Description]))>0 THEN
LEFT(SUBSTRING(#Store.[Description], CHARINDEX('to ', #Store.[Description], CHARINDEX('Store Limit changed from ', #Store.[Description]))+3, CHARINDEX('', #Store.[Description]+'', CHARINDEX('to ', #Store.[Description], CHARINDEX('Store Limit changed from ', #Store.[Description]))+3)- CHARINDEX('to ', #Store.[Description], CHARINDEX('Store Limit changed from ', #Store.[Description]))-3),8)
ELSE NULL
END 'Store Limit'
FROM #Store
I ' m trying to get only the ending number 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!