How do i differentiate unicode characters

  • declare @ch1 char

    declare @ch2 char

    select @ch1='Ψ'

    select @ch2='?'

    IF(ASCII(@ch1)=ASCII (@ch2))

    print 'hi ascii'

    if(NCHAR(ASCII(@ch1))=NCHAR(ASCII (@ch2)))

    print 'hi char'

    IF(@ch1=@ch2)

    print 'hi original'

    ///Can one help me out to fail the if condition with the same variales @ch1 and @ch2

    thanks
    sarat 🙂
    Curious about SQL

  • Instead of CHAR try using NCHAR..

  • As in

    declare @ch1 Nchar

    declare @ch2 Nchar

    select @ch1=N'?'

    select @ch2=N'?'

    IF(@ch1=@ch2)

    print 'we are same'

    else

    print 'We are different'

    Hope this helps

  • You can set like

    select @ch1=N'?'

    select @ch2=N'?'

  • Thanks 🙂

    thanks
    sarat 🙂
    Curious about SQL

Viewing 5 posts - 1 through 4 (of 4 total)

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