Solved

SQL Server and XML Insert Just Wondering

Posted on 2013-06-03
2
398 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
Comment Utility
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
Comment Utility
Thanks.
Was just wondering.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

763 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

8 Experts available now in Live!

Get 1:1 Help Now