XML Data Type error

RobertKaucherRobertKaucher Member Posts: 4,298 ■■■■■■■■■■
I am attempting the following query:

---
DECLARE @MyXML AS XML(MyXMLSchema)
SET @MyXML '<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>'
INSERT INTO OrderDetails values('John', 'Smith', '513.555.1212', @MyXML)
---
I get the following error:

---
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>40'.
---
Any ideas?

Comments

Sign In or Register to comment.