Pattern Matching Query in SQL
I have the following query
SELECT PATINDEX('%[A-Z][A-X0-9][0-9]% [0-9][A-Z][A-Z]', LTRIM(RTRIM(Address))), Address, IDNumber
FROM <MYTABLE>
What I want to be able to do is ensure there is white space before the first part of my PATINDEX , PATINDEX('[A-Z]….
I’ve tried
PATINDEX(' [A-Z]….
PATINDEX('%[A-Z]….
PATINDEX('% [A-Z]….
PATINDEX('[ ][A-Z]….
What I want to ensure is that the PATINDEX doesn’t look in the middle of a word and find a match, which is what it is currently doing.
I'm using SQL Server 2000.
Thanks