store arabic in SQL database

前端 未结 9 532
栀梦
栀梦 2020-11-30 05:55

I tried to store Arabic string in SQL 2008 database but it converted to \" question mark \" why ? and what should I do ?

相关标签:
9条回答
  • 2020-11-30 06:18

    This is helpful but work here's what works for me in all cases

    ALTER DATABASE [database] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

    GO

    ALTER DATABASE [database] COLLATE ARABIC_CI_AS;

    GO

    ALTER DATABASE [database] SET MULTI_USER;

    GO

    update: eventually I have to change datatype varchar to nvarchar in my project

    0 讨论(0)
  • 2020-11-30 06:24

    Add 'N' before every value. example:

    INSERT INTO table1 VALUES(N'aaaaaaaaa',N'ששששששששששששש',N'aaaaaaaaaaa',N'ششششششششششش')
    
    0 讨论(0)
  • 2020-11-30 06:26

    make sure all your tables and varchar columns have the collation of utf8_general_ci

    0 讨论(0)
提交回复
热议问题