Searching for records that contain Unicode characters

  • I have a field that is type nvarchar, but I don't know if it actually has any Unicode characters in it or not. I would like to change it to varchar if it doesn't currently use Unicode characters. Is there some way I can query this field for just the records that contain Unicode characters?

    I tried converting an nvarchar field that I know does not contain Unicode characters, and SQL Server still gives me a warning that data might be lost - I wish there was some way for it to tell me when data will actually be lost.

  • I guess if you try to select a convert(varchar(...), yourcol) you'll find out.

    select convert(varchar(...), yourcol) as varcol

    , yourcol

    from yourtable

    where convert(varchar(...), yourcol) <> yourcol

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Thanks, it worked. I didn't realize that ASCII could handle acute accents, but apparently it can.

Viewing 3 posts - 1 through 2 (of 2 total)

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