5

将多语言数据插入 SQL 2008 数据库(nvarchar 字段) 我注意到它似乎丢失了一些特殊字符标记。

例如

    INSERT INTO [dbName].[dbo].[tbl_Question_i18n]  
           ([QuestionId]  
           ,[LanguageId]  
           ,[QuestionText])  
     VALUES  
           (@lastinsertedquestionid  
           ,@romanian  
           ,'Număr unic de referinţă (URN)')  

被插入为“Numar unic de referinta (URN)”

尽管如果我执行“编辑前 200 行”,我可以毫无问题地将相同的文本直接粘贴到该字段中。

请问我错过了什么?

4

1 回答 1

8
INSERT INTO [dbName].[dbo].[tbl_Question_i18n]  
       ([QuestionId]  
       ,[LanguageId]  
       ,[QuestionText])  
 VALUES  
       (@lastinsertedquestionid  
       ,@romanian  
       ,N'Număr unic de referinţă (URN)')

您需要N在字符串常量之前使其成为 Unicode

于 2010-07-14T16:31:13.480 回答