Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tlallo
Starting Member
3 Posts |
Posted - 2013-02-21 : 06:39:33
|
Hi, Can someone please help...I 'm trying to insert Chinese character in column with a data type xml. |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-02-21 : 07:24:12
|
DECLARE @tab1 TABLE( col xml)INSERT INTO @tab1 VALUES( N'?')SELECT * FROM @tab1 ? refers any chinese character ( You can replace ? with chinese character)--Chandu |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-21 : 08:27:13
|
To add to what Chandu said: XML in SQL supports unicode characters, so you should not have to do anything special to insert Chinese characters. Are you having any difficulties? If you are, it may be because your OS does not have support for it, or because you are using non-unicode strings somewhere along the way (e.g., you should be using NVARCHAR instead of VARCHAR). |
|
|
tlallo
Starting Member
3 Posts |
Posted - 2013-02-22 : 03:25:42
|
Hi Bandi,Thanks for the respond, it did work but my issue is when i'm inserting the chinese in an xml like the following:UPDATE [Table_name] SET [Col_xml] = '<?xml version="1.0" encoding="UTF-8"?><book> <person> <first>'Chinese letters'</first> <last>Pai</last> <age>22</age> </person></book>'When executing the select on the table_name i see <first>??</first> instead of 'Chinese letters'quote: Originally posted by bandi DECLARE @tab1 TABLE( col xml)INSERT INTO @tab1 VALUES( N'?')SELECT * FROM @tab1 ? refers any chinese character ( You can replace ? with chinese character)--Chandu
|
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-02-22 : 04:12:53
|
DECLARE @EDetails TABLE ( NAME xml )INSERT INTO @EDetails VALUES(N'?')UPDATE @EDetailsSET NAME = N'<book><person><first>???? ÓPCM üñ ¿¡</first><last>Pai</last><age>22</age></person></book>'select * from @EDetails-- Another exampledeclare @x TABLE(col xml )INSERT INTO @x VALUES( N'<tag>abc</tag>')UPDATE @x set col.modify (N'replace value of (/tag/text())[1] with "?"') select * FROM @x--Chandu |
|
|
tlallo
Starting Member
3 Posts |
Posted - 2013-02-22 : 04:59:05
|
Yes!!!! it is working....thanks quote: Originally posted by bandi DECLARE @EDetails TABLE ( NAME xml )INSERT INTO @EDetails VALUES(N'?')UPDATE @EDetailsSET NAME = N'<book><person><first>???? ÓPCM üñ ¿¡</first><last>Pai</last><age>22</age></person></book>'select * from @EDetails-- Another exampledeclare @x TABLE(col xml )INSERT INTO @x VALUES( N'<tag>abc</tag>')UPDATE @x set col.modify (N'replace value of (/tag/text())[1] with "?"') select * FROM @x--Chandu
|
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-02-22 : 05:03:48
|
Welcome--Chandu |
|
|
|
|
|