Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    3

    Unanswered: PATINDEX fails to find (UK Pound Sterling symbol)

    Hi all, Has anyone ever tried looking for a UK Pound sign using the PATINDEX function? It's fine for other characters but fails to find
    The following code returns -1 because the function does not locate the pound symbol (it is in there!)
    SELECT @intPos = PATINDEX('%%', [my_text_field]) FROM my_table
    Any suggestions?
    Many thanks!

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    I just tried a little test...

    Code:
    declare @v1 varchar(10), @v2 nvarchar(20)
    select @v1 = '100.00', @v2 = '100.00'
    select @v1, @v2
    select PATINDEX('%%', @v1),PATINDEX('%%', @v2)
    
    and got 
    
    ---------- -------------------- 
    100.00    100.00
    
    ----------- ----------- 
    1           1
    do you have anymore details?
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Jan 2003
    Posts
    3

    Talking

    Ah, yes your test certainly works! Your test spurred me to rey something out...Indeed I've found out why my code was not working...

    It turned out that the data I was accessing contained a unc pound character amongst the text, this looked correct in my WinXP Notepad but manifested as two odd characters when viewed in sql server, that's why my search for a normal pond character was failing!

    Thanks for you help!

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    sometimes it's hard to see the forrest because of all the trees! Gald to help!
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

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