Solved

SQL Server and XML Insert Just Wondering

Posted on 2013-06-03
2
408 Views
Last Modified: 2013-06-04
I have a VB.Net process that is passing in XML as VARCHAR, 8000 to SQL Server 2005 table
oCom.Parameters.Add(New SqlParameter("@XmlDoc", SqlDbType.VarChar, 8000)).Value = s

The XML looks like this
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<org.m5.api.v1.Response xmlns:m5="http://www.something.com/org/sm/data/v2/cti" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed5">
    <ErrorCount>0</ErrorCount>
    <Id>1</Id>
    <Result xsi:type="org.m5.data.v2.cti.HostedConnectObject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <csta:MonitorStartResponse>
            <csta:monitorCrossRefID>647</csta:monitorCrossRefID>
        </csta:MonitorStartResponse>
    </Result>
</org.m5.api.v1.Response>

Open in new window


In my database the table column...set as XML stores the data fine.
However...it strips off the top xml row of my XML.

Just wondering why.
This is what it stores.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Open in new window

0
Comment
Question by:lrbrister
2 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 39217805
However...it strips off the top xml row of my XML.
That is the way Xml is stored in SQL Server when using an Xml data type.  If it is important to you than consider saving the Xml document to a column with  a data type of varchar  or char.
0
 

Author Closing Comment

by:lrbrister
ID: 39218780
Thanks.
Was just wondering.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question