Hi i have an xml string
DECLARE @XmlQue NTEXT
SET @XmlQue='<?xml version="1.0" encoding="UTF-16"?><Template TId="1">
<QueInfo QId="1" QDetails="Are you " IsYes="Yes" IsNo="No" Eligibleyes="Y" Eligibleno="N"/>
<QueInfo QId="2" QDetails=" राज्य " IsYes="Yes" IsNo="No" Eligibleyes="Y" Eligibleno="N"/>
</Template>'
i want to insert the data in a table having NTEXT data type in some columns
i have written the following insert statement.
INSERT INTO ExpertSystem_Master
SELECT QIdx,@TemplateId,QDetailsx,IsYesx,IsNox,Eligibleyesx,Eligiblenox,0,0
FROM
OPENXML(@XmlHdl,'/Template/QueInfo',1)
WITH
( QIdx INT '@QId',
QDetailsx Ntext '@QDetails',
IsYesx Ntext '@IsYes',
IsNox Ntext '@IsNo',
Eligibleyesx CHAR(1) '@Eligibleyes',
Eligiblenox CHAR(1) '@Eligibleno'
)
The data is inserted in the table but the issue is instead of setting " राज्य" ,the data is inserted as "?????"
when i try to insert the data directly it is inserted properly,the issue is while parsing it with OPENXML.
can any one help?? am i missing something?
Thanks in advance.
put an N before your text.. example:
SET @XmlQue=N'<?xml version="1.0" encoding="UTF-16"?><Template TId="1">
<QueInfo QId="1" QDetails="Are you " IsYes="Yes" IsNo="No" Eligibleyes="Y" Eligibleno="N"/>
<QueInfo QId="2" QDetails=" राज्य " IsYes="Yes" IsNo="No" Eligibleyes="Y" Eligibleno="N"/>
</Template>'