Hi I want to retrieve date from description.
Following is the code I am using it now,But I have to write this syntax 12 times for each different month.
I mean below example is for Jan.if I have @desc='Call: (FM) abc Co Feb 21 12 $219.5 (100 Shs)' then I have to add one more case condition.
Is there any simple way to do this?
DECLARE @desc VARCHAR(200)='Call: (MF) xyz Co Jan 21 12 $219.5 (100 Shs)'
SELECT CASE WHEN @desc LIKE '%Jan%'
THEN SUBSTRING(@desc,PATINDEX('%Jan%',@desc)
,PATINDEX('%[$]%',@desc)-PATINDEX('%Jan%',@desc)) END