I am doing pattern searching and extracting just the number following pattern. This has been answered in thread 1751572.
I was searching for 'LDL', but have come across a pattern where both LDL and VLDL are in the pattern and not always in the same order nor is there a Space always proceeding LDL. This may be similar to finding only men but not women in a string. I tried to exclude the 'V' but just got all zeros.
Here is an examples:
Thank you.
You don't know what you don't know...
I was searching for 'LDL', but have come across a pattern where both LDL and VLDL are in the pattern and not always in the same order nor is there a Space always proceeding LDL. This may be similar to finding only men but not women in a string. I tried to exclude the 'V' but just got all zeros.
Here is an examples:
Code:
IF OBJECT_ID('TEMPDB..#demo') IS NOT NULL DROP TABLE #demo
CREATE TABLE #demo(SubjectID int, TextResult varchar(50))
INSERT INTO #demo VALUES (1, 'VLDL 10, LDL 90')
,(2, 'LDL 160, VLDL 35')
,(3, 'VLDL=25 LDL=160')
,(4, 'HDL(60) LDL(160) VLDL(30)')
SELECT
CHARINDEX('[^V]LDL', [TextResult])
FROM #demo
Thank you.
You don't know what you don't know...