Solved

SQL Server and XML Insert Just Wondering

Posted on 2013-06-03
2
406 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

912 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now