我正在尝试使用中文字符更新标记的值。但是它不会添加中文字符。而是添加“???” 。 例如更新表集col.modify('替换值(/ tag / text())[1]和“我”')其中.. 非常感谢任何帮助
感谢 本
答案 0 :(得分:4)
对于像这样的国际字符,你通常想要使用N'this is my data'来表示它是unicode / nchar。否则它被视为char,我假设db collation不支持您提交的字符。尽量做到
select 'my chars'
看看你是否还有问号,我会这么认为。
编辑 - 这是一个确认我的建议有效的例子:
declare @x xml
set @x = N'<tag>abc</tag>'
set @x.modify (N'replace value of (/tag/text())[1] with "我"')
select @x
当我选择xml时,我看到符号,并且我验证了字符前后是0x1162(证明数据完好无损)。
答案 1 :(得分:2)
您使用的是unicode字符串吗?那些以大写N开头,如:
update yourtable
set yourvalue = N'your chinese characters'
where id = yourid