none
compare encoded japanese characters with japanese character in sql server

    Question

  • hi all,

    whenever creating view with the below condition i am not getting any value in the view .

    1.the table contains encoded japanese characters. it was stored as special characters like ? and * in table.

    2.i am  trying to create a view using the following query

    "CREATE VIEW [view-name] WITH SCHEMABINDING AS (SELECT "table-name"."attribute"  FROM "table-name" WHERE (( ISNULL("table-name"."attribute", ' ')  =  '漢字漢字漢字漢字漢' )))"

    3.table in the view is not containing any value for the attribute(the select command does not return anything)

    4.whenever i use > symbol instead of = its return some value from the table (< and = operators does return any value in select command)

    can anyone please help me out .

    Monday, July 01, 2013 10:32 AM

Answers

  • You need to make the literal you are testing be 16 bit.  So  use N'漢字漢字漢字漢字漢', not  '漢字漢字漢字漢字漢'.

    Also, what is the datatype of  "table-name"."attribute"?  It also needs to be 16 bit characters, that is (for example) nvarchar, not varchar.

    Tom

    Monday, July 01, 2013 12:34 PM

All replies

  • You need to make the literal you are testing be 16 bit.  So  use N'漢字漢字漢字漢字漢', not  '漢字漢字漢字漢字漢'.

    Also, what is the datatype of  "table-name"."attribute"?  It also needs to be 16 bit characters, that is (for example) nvarchar, not varchar.

    Tom

    Monday, July 01, 2013 12:34 PM
  • its varchar Tom, 

    thanks Tom.

    Tuesday, July 02, 2013 5:33 AM
  • Hi _prasad,

    We received ? and * when querying data from SQL Server because the stored data cannot be displayed properly, as Tom suggested, we can store the Chinese or Japanese characters as nvarchar data type. 

    Allen Li
    TechNet Community Support

    Friday, July 12, 2013 5:44 AM
    Moderator
  • Hi,

    Be aware that Far East languages like Japanese require a 16-bit encoding (because they have far more

    symbols than the 256 offered by 8-bit CHARs)

    You must use NCHAR, NVARCHAR or NTEXT fields to manipulate Japanese strings.


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    Friday, July 12, 2013 12:02 PM
  • The following blog is on the same topic:

    http://www.sqlusa.com/bestpractices2005/chinesecharacters/


    Kalman Toth Database & OLAP Architect sqlusa.com
    New Book / Kindle: SQL Server 2012 Administration


    Saturday, July 20, 2013 3:30 AM
    Moderator