Questions tagged [sql-server-openxml]

OPENXML is a SQL Server keyword that provides a rowset over in-memory XML documents which can be treated like a table or a view.

OPENXML, a Transact-SQL keyword, provides a rowset over in-memory XML documents that is similar to a table or a view. OPENXML allows access to XML data as though it is a relational rowset. It does this by providing a rowset view of the internal representation of an XML document. The records in the rowset can be stored in database tables.

OPENXML can be used in SELECT and SELECT INTO statements wherever rowset providers, a view, or OPENROWSET can appear as the source. For information about the syntax , see OPENXML (Transact-SQL).

To write queries against an XML document by using OPENXML, you must first call sp_xml_preparedocument. This parses the XML document and returns a handle to the parsed document that is ready for consumption. The parsed document is a document object model (DOM) tree representation of various nodes in the XML document. The document handle is passed to OPENXML, which then provides a rowset view of the document based on the parameters passed to it.

Source: Microsoft (OPENXML Keyword)

55 questions
0
votes
1 answer

SQL Update From XML always return null

I have a bit of problem, I get this code from the internet and i alter it for my own use. i run the sample and it works fine, no problem. after i change it for my program, it doesnt show any error, just 0 rows affected. turned out, the xml column…
0
votes
1 answer

USE Open XML to extract the CDATA

I have xml which has the data embedded in CDATA. I would like to extract the info in different fields. But not able to do it.
TD2013
  • 97
  • 1
  • 3
  • 13
0
votes
1 answer

OPENXML Drops Trailing CHAR(13)+CHAR(10)

When I run this SQL in SSMS (all versions 2005-2014) the final select statement's Child column has data that is missing the final CHAR(13) and CHAR(10). Is there a way to have OPENXML or it's WITH clause specify not to truncate these…
sisdog
  • 2,649
  • 2
  • 29
  • 49
0
votes
1 answer

parse openxml and get a name value collection for given node

I have a xml document which contains some custom fields which i wont know the names of. i want to generate a select statement which will list the contents in a name value style. All examples I have found sofar require me to know the names of the…
Tim
  • 7,401
  • 13
  • 61
  • 102
0
votes
0 answers

SQL Server Xquery retrieve generated id for child parent relationship

Is it possible to use Xpath in a query to get child parent relation ship using XQuery. If I use EXEC sp_xml_preparedocument @hDoc OUTPUT, @XML, '' and after that use the metadata properties I will receive a…
Anders Nilsson
  • 1,465
  • 12
  • 12
0
votes
2 answers

Open word in Report Viewer

Im using a ASP.Net 4. I want to be able to display a word document in the microsoft report viewer . This document is uploaded by the user and needs to be displayed in the report viewer ? How do i go about this ?
0
votes
1 answer

Why rolling back transation in SQL Server increases seed values

I am doing some initial development in SQL Server 2008 version and because it was test script I had script the queries in transaction to not affect the database tables actually. But it seems the records are not entered into database but the seed…
0
votes
1 answer

In SQL Server 2005, how can I store XML nodes in a table while preserving document order?

I have an xml file where the ordering of nodes is important, like this one: I'm using OPENXML to store these nodes in a table variable.…
Esteban Brenes
  • 1,153
  • 1
  • 15
  • 20
0
votes
1 answer

Bulk insert using sql server openxml with dynamic sql from .Net

I wrote the following procedure to do bulk insert using openxml. The table name and column names are dynamic in my case as they will be created from .Net application just before this below insert. The stored procedure is running successfully but not…
gee'K'iran
  • 431
  • 2
  • 7
  • 21
-2
votes
1 answer

Return same node value from child node openxml sql

I have following XML:- 1 Size XXL ProdTaxType
1 2 3
4