我有XML數據類型作爲表列。我在其中存儲了一些XML文本。 XML文本包含一些希伯來文字符,但在我將它存儲在表格中後,所有希伯來字符都變成了「?」。我能做些什麼來解決它?將Unicode數據存儲在SQL Server 2008中XML數據類型
這是我的UPDATE語句:
update db_owner.Screen_Template set template_xml =
'<?xml version="1.0"?>
<Screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../GUIGenerator_V2/Scheme/GG_Scheme.xsd">
<Legend EntityType="Request">
<Module ForceTabs="1">
<Events>
<Event Value="onafter_moduleinit_beforedraw()" Type="onafter_moduleinit_beforedraw"/>
</Events>
<Section Id="Header" Type="header" Caption="Header" ContainerCSS="background:#C1E0F4;border-bottom:2px groove;margin-bottom:3px;padding:10 3 3 3">
<Containers>
<Form Id="Header" Caption="General Details" Source="Request" Layout="Fixed">
<Layout>
<table cellaspacing="0" cellpadding="0">
<tr>
<td>
<ControlRef Id="Origin" ShowCaption="1"/>
</td>
<td>
<ControlRef Id="Type" ShowCaption="1"/>
</td>
<td>
<ControlRef Id="Process" ShowCaption="1"/>
</td>
<td width="20" align="center">
<span class="separator"/>
</td>
<td>
<ControlRef Id="FindBy" ShowCaption="1"/>
</td>
<td>
<ControlRef Id="Find"/>
</td>
<td>
<button width="30" onclick="doFindCustomer()">
<Caption Caption="GO"/>
</button>
</td>
</tr>
</table>
</Layout>
<Controls>
<Control Id="Origin" Caption="Origin" FieldName="Origin" DataType="string" Width="90" CaptionWidth="70" ReadOnly="1" Mandatory="1" Hidden="1"/>
<Control Id="Type" Caption="Type" FieldName="Type" DataType="select" Width="60" CaptionWidth="40" ReadOnly="1" Mandatory="1" DefaultValue="Service" Hidden="1">
<Member Value="Allert" Caption="Allert"/>
<Member Value="Service" Caption="Service"/>
<Member Value="Marketing" Caption="Marketing"/>
</Control>
<Control Id="Process" Caption="Process" FieldName="Process" DataType="string" Width="90" CaptionWidth="70" ReadOnly="1" Mandatory="1" Hidden="1"/>
<Control Id="FindBy" Caption="Find:" VCaption="Find By" FieldName="FindBy" DataType="select" Width="90" CaptionWidth="50" ReadOnly="0" Mandatory="0" CaptionCSS="font-weight:bold" DefaultValue="IMTSI">
<Member Value="IMTSI" Caption="IMTSI"/>
<Member Value="ID" Caption="ID"/>
</Control>
<Control Id="Find" Caption="Find Value" FieldName="Find" DataType="string" Width="90" CaptionWidth="60" ReadOnly="0" Mandatory="0" CaptionCSS="font-weight:bold"/>
</Controls>
</Form>
</Containers>
</Section>
<Section Id="1" Type="page" Caption="tech visit sms reminder">
<Containers>
<Form Id="General" Caption="General Details" Source="Request" Layout="Fixed">
<Controls>
<Control Id="IMTSI" Caption="IMTSI" Source="Param[@Name = ''IMTSI'']" FieldName="Value" DataType="string" Width="120" CaptionWidth="120" BreakAfter="1" Mandatory="0" Hidden="1"/>
<Control Id="MessageType" Caption="Message Type" Source="Param[@Name = ''MessageType'']" FieldName="Value" DataType="select" Width="150" CaptionWidth="120" ReadOnly="1" Mandatory="1" DefaultValue="Allert" Action="handleMessageTypeChange()" BreakAfter="1">
<Member Value="SMS" Caption="SMS"/>
<Member Value="EMAIL" Caption="EMAIL"/>
<Member Value="ATOS" Caption="ATOS"/>
<Member Value="SELF SERVICE" Caption="SELF SERVICE"/>
</Control>
<Control Id="Language" Caption="Language" Source="Param[@Name = ''Language'']" FieldName="Value" DataType="select" Width="120" CaptionWidth="120" ReadOnly="0" BreakAfter="1" SelectionType="single" Hidden="0" SeparateAfter="1">
<Member Value="heb" Caption="heb"/>
<Member Value="eng" Caption="eng"/>
</Control>
<Control Id="Mobile" Caption="Mobile" Source="Param[@Name = ''Mobile'']" FieldName="Value" DataType="string" Width="120" CaptionWidth="120" BreakAfter="1" Mandatory="1" SeparateAfter="0"/>
<Control Id="FirstName" Caption="First Name" Source="Param[@Name = ''FirstName'']" FieldName="Value" DataType="string" Width="120" BreakAfter="1" CaptionWidth="120" Mandatory="1"/>
<Control Id="Visitday" Caption="Visit day" Source="Param[@Name = ''Visitday'']" FieldName="Value" DataType="select" Width="120" CaptionWidth="120" ReadOnly="0" BreakAfter="1" Mandatory="1" SeparateBefore="1" SeparateAfter="1">
<Member Value="א" Caption="ראשון"/>
<Member Value="ב" Caption="שני"/>
<Member Value="ג" Caption="שלישי"/>
<Member Value="ד" Caption="רביעי"/>
<Member Value="ה" Caption="חמישי"/>
</Control>
<Control Id="Date" Caption="Visit date" Source="Param[@Name = ''Date'']" FieldName="Value" DataType="date" EnableTime="0" Width="120" CaptionWidth="120" Height="60" BreakAfter="1" MaxLen="20" Mandatory="1" SeparateBefore="1" SeparateAfter="1"/>
<Control Id="Visithours" Caption="Visit hours" Source="Param[@Name = ''Visithours'']" FieldName="Value" DataType="string" EnableTime="1" Width="120" CaptionWidth="120" Height="60" BreakAfter="1" MaxLen="20" Mandatory="1" SeparateBefore="1" SeparateAfter="1"/>
<Control Id="Email" Caption="Email" Source="Param[@Name = ''Email'']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" Mandatory="0" Hidden="1"/>
<Control Id="Subject" Caption="Subject" Source="Param[@Name = ''Subject'']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" MaxLen="40" Hidden="1"/>
<Control Id="Sender" Caption="Sender" Source="Param[@Name = ''Sender'']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" ReadOnly="1" BreakAfter="1"/>
<Control Id="Priority" Caption="Priority" Source="Param[@Name = ''Priority'']" FieldName="Value" DataType="select" Width="350" CaptionWidth="120" BreakAfter="1" DefaultValue="LOW" Hidden="1">
<Member Value="LOW" Caption="Low" Glyf="../../GUIGenerator_V2/assets/themes/Images/flag_blue.png"/>
<Member Value="MED" Caption="Medium" Glyf="../../GUIGenerator_V2/assets/themes/Images/flag_yellow.png"/>
<Member Value="HIGH" Caption="High" Glyf="../../GUIGenerator_V2/assets/themes/Images/flag_red.png"/>
</Control>
</Controls>
</Form>
</Containers>
</Section>
</Module>
<DefaultData>
<Request Origin="ISRAEL" Type="Service" Process="17">
<Param Name="MessageType" Type="Field" Value="SMS"/>
<Param Name="FirstName" Type="Field"/>
<Param Name="Visitday" Type="Field"/>
<Param Name="Date" Type="Field"/>
<Param Name="Visithours" Type="Field"/>
<Param Name="Mobile" Type="Field"/>
<Param Name="Sender" Type="Field" Value="BTP|*5755"/>
<Param Name="Priority" Type="Field" Value="LOW"/>
<Param Name="Language" Type="Field" Value="heb"/>
</Request>
</DefaultData>
</Legend>
<Data/>
</Screen>'
where UID like '4'
和SELECT語句:
SELECT * FROM Screen_Template WHERE env LIKE '" + env + "' AND OpCo LIKE '" + opco + "' AND UID LIKE '" + uid + "'"
XML數據類型存儲一切都在UCS-2的Unicode(每個字符2個字節),所以基本上應該能夠處理希伯來文字符就好了。你是如何將數據插入XML列的? – 2012-02-27 06:46:16
通過使用更新語句我試圖在xml文本之前添加'N',但仍然將每個希伯來字符更改爲'?' – user1176926 2012-02-27 07:24:03
什麼似乎是問題? – user1176926 2012-02-27 07:39:09