怎么样把韩语寸入数据库并且读出来的也是韩语? 

解决方案 »

  1.   

    使用unicode码来进行操作.UNICODE
    按照 Unicode 标准的定义,返回输入表达式的第一个字符的整数值。 语法
    UNICODE ( 'ncharacter_expression' )参数
    'ncharacter_expression'是 nchar 或 nvarchar 表达式。 返回类型
    int示例
    A. 使用 UNICODE 和 NCHAR
    下面的示例使用 UNICODE 和 NCHAR 函数打印 Åkergatan 24 字符串中第一个字符的 UNICODE 值,并打印实际的第一个字符 Å。DECLARE @nstring nchar(12)
    SET @nstring = N'Åkergatan 24'
    SELECT UNICODE(@nstring), NCHAR(UNICODE(@nstring))下面是结果集:----------- - 
    197         Å
    B. 使用 SUBSTRING、UNICODE 和 CONVERT 函数
    下面的示例使用 SUBSTRING、UNICODE 和 CONVERT 函数输出字符串 Åkergatan 24 中每个字符的字符号、Unicode 字符和 UNICODE 值。-- The @position variable holds the position of the character currently
    -- being processed. The @nstring variable is the Unicode character 
    -- string to process.
    DECLARE @position int, @nstring nchar(12)
    -- Initialize the current position variable to the first character in 
    -- the string.
    SET @position = 1
    -- Initialize the character string variable to the string to process. 
    -- Notice that there is an N before the start of the string, which 
    -- indicates that the data following the N is Unicode data.
    SET @nstring = N'Åkergatan 24'
    -- Print the character number of the position of the string you are at, 
    -- the actual Unicode character you are processing, and the UNICODE 
    -- value for this particular character.
    PRINT 'Character #' + ' ' + 'Unicode Character' + ' ' + 'UNICODE Value'
    WHILE @position <= DATALENGTH(@nstring)
    -- While these are still characters in the character string,
       BEGIN
       SELECT @position, 
          CONVERT(char(17), SUBSTRING(@nstring, @position, 1)),
          UNICODE(SUBSTRING(@nstring, @position, 1))
       SELECT @position = @position + 1
       END下面是结果集:Character # Unicode Character UNICODE Value
                                              
    ----------- ----------------- ----------- 
    1           Å                 197         
                                              
    ----------- ----------------- ----------- 
    2           k                 107         
                                              
    ----------- ----------------- ----------- 
    3           e                 101         
                                              
    ----------- ----------------- ----------- 
    4           r                 114         
                                              
    ----------- ----------------- ----------- 
    5           g                 103         
                                              
    ----------- ----------------- ----------- 
    6           a                 97          
                                              
    ----------- ----------------- ----------- 
    7           t                 116         
                                              
    ----------- ----------------- ----------- 
    8           a                 97          
                                              
    ----------- ----------------- ----------- 
    9           n                 110         
                                              
    ----------- ----------------- ----------- 
    10                            32          
                                              
    ----------- ----------------- ----------- 
    11          2                 50          
                                              
    ----------- ----------------- ----------- 
    12          4                 52
      

  2.   

    用nvarchar和nchar数据类型
    insert时,字符串前加N,如 N'韩语'
      

  3.   

    将字符串字段设置为Nvarchar或者ntext字段
      

  4.   

    数据库使用NXXX类型,关键是前台程序要注意。使用支持unicode的数据驱动(如ADO),界面显示也要支持Unicode就一切ok。
    我以前用Delphi+Sql2000开发过中韩文的系统。没什么问题。如果使用.net开发就爽了。不用管什么中韩日的,都是Unicode字符。