Solved

SQL Server and XML Insert Just Wondering

Posted on 2013-06-03
2
412 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

726 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