How to match a UNICODE NULL character within an nVarchar(128) string?

  • mrTexasFreedom (1/17/2013)


    Lowell,

    Sadly, this isn't matching any rows:

    select id, name

    FROM my_user_table

    WHERE CHARINDEX(name,CHAR(0),1) > 0

    No rows returned. Likewise, the replace operation doesn't touch any of the rows. Ideas?

    Thank you very much for the help you've provided thus far. I feel like I'm on the verge of clobbering this beast thanks to your assistance!

    mtf

    Its not returning any rows because U cannot use a search expression first followed by a find expression in the syntax of CHARINDEX

    if you use CHARINDEX (CHAR(0), name, 1 ), I surely believe you will catch the bad hidden characters.. I know this thread is pretty old. But I just loved the way you all made it so quick learning session.. Thanks to Lowell for sharing this thread to me..

    --Pra:-):-)--------------------------------------------------------------------------------

  • Thanks for spotting that. I'll try that out in my test DB and see if it is a more efficient method.

    Appreciatively,

    mtf

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply