Results 1 to 3 of 3

Thread: Pattern Matching Query in SQL

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    39

    Question 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
    Last edited by Gin_bee; Jan 23rd, 2004 at 09:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width