Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008
    Posts
    56

    Unanswered: TSQL for regular expression

    Hi,
    Does anyone know a quick way to check in a funtion how to check if a variable contains any characters and also to check for the presence of numbers within the variable?


    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    CASE WHEN @v LIKE '%[A-Za-z]%' THEN 'Got Chars' END
    , CASE CASE WHEN @v LIKE '%[0-9]%' THEN 'Got Numbies' END
    The char checking code won't work for some collations (e.g. Binary).
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    I think this will get you going in the right direction:
    Just geeks: Adding Regular Expressions (Regex) to SQL Server 2005
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Good call rdjabarov!

    Regex support is the primary reason most of my projects have opted for CLR support. For heavy-hitting string crunching and manipulation options, you really can't beat .NET RegEx.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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