sqlxml

SQL Server 2008: SQLXML Query function .query('//mypath/text()') doesn't XML decode

In Microsoft SQL Server 2008, when executing .query('{xpath}/text()') on an XML stream column value, if the value of the XPath selected node contains "&", the return value is "&amp" instead of "&". Is this a bug, or am I doing something wrong? Or rather, how do I get the unencoded text, i.e. equivalent of .innerText (per W3C XML DOM...

Exposing web based XML data via a SQL Server view

It seems that SQL Server has a fair amount of XML support. Mostly I've seen info regarding storing XML in SQL Server, querying XML data stored in SQL Server, and exposing data as XML. Is the following scenario an option: I'd like to expose xml data (it's an RSS view of workitems) from a web site via a SQL Server view. The motivation is...

Is it possible to use SQL XML to insert, and get output from each record?

I would like to perform a SQL XML insert (on MSSQL), and in this case I need to insert a list of files into the DB (this is simple enough). However, there's an auto generated PK column (ID), and I need the ID for each newly created filename without performing a 2nd query. Is this possible? I guess it doesn't matter if the result is/isn't...

Sql XML Path with different children

Hi, I have done a lot of XML PATH statements, but this one escapes me or might not even be possible with multiple different children. The end result should look like this <Process> <TaskList> <SqlTask Name="Get Report Parameters"> <StoredProcName>GetReportParameters</StoredProcName> <ConnectionName>Local</ConnectionName> ...

How to pass SQLXML type to view in Spring MVC?

In my webapp controller I'm getting results from the db, which are of type java.sql.SQLXML. I want to pass it to the view to be returned verbatim (as XML). The problem is, the data associated with SQLXML is released as soon as I leave JdbcTemplate call. How then should I pass the data to the view using a model? ...

how to COPY Attribute value in a new attribute

How to copy data of attribute to new attribute in the same column in sql original data <root> <child attr='hello'></child> </root> Result 1 <root> <child attr='hello' attr2='hello'></child> </root> Result 2(with a modification) <root> <child attr='hello' attr2='**H**ello **W**orld'></child> </root> I want to do this only throu...

Using SQLXML Bulk Load in .NET Environment - Error with One to Many relationship on Complex Type

Hi, I have an error when I am importing an XML file using SQLXMLBulkLoad, wondering if anyone could help. Error: Data mapping to column 'Attribute' was already found in the data. Make sure that no two schema definitions map to the same column Full files and details can be found here http://www.experts-exchange.com/Microsoft/Development/...

SQL Server 2005 FOR XML

Hi, I want to export data from a table to a specifically formatted XML file. I am fairly new to XML files, so what I am after may be quite obvious but I just cant find what I am looking for on the net. The format of the XML results I need are: <data> <event start="May 28 2006 09:00:00 GMT" end="Jun...

createSQLXML() AbstractMethodError (with DB2XADataSource?)

Environment: WASCE 2.0.0.4 (aka geronimo 2.1) db2jcc4.jar 4.3.85 (tried 4.8.x as well) tranql-connector-db2-xa 1.4 (tried 1.5 as well) SQLXML xml = c.createSQLXML(); Struggling with java.lang.AbstractMethodError: java/sql/ResultSet.getSQLXML(I)Ljava/sql/SQLXML; at [snip] at javax.servlet.http.HttpServlet.service(HttpServlet.java:6...

XML output from MySQL

Hi, is there any chance of getting the output from a MySQL query directly to XML? Im referring to something like MSSQL has with SQL-XML plugin, for example: SELECT * FROM table WHERE 1 FOR XML AUTO returns text (or xml data type in MSSQL to be precise) which contains an XML markup structure generated according to the columns in the ...

Neat XML from T-SQL

Lets say we have a table "Names": ID Name Surname 1 Matt Smith 2 John Doe How would you write some SQLXML to generate this: <people> <person> <name>Matt</name> <surname>Smith</surname> <person> <person> <name>John</name> <surname>Doe</surname> <person> </people> The best I've got is this:...

Flattening XML in SQLXML

I have this XML in T-SQL: <Elements> <Element> <Index>1</Index> <Type>A</Type> <Code>AB</Code> <Time>1900-01-01T10:21:00</Time> </Element> <Element> <Index>2</Index> <Type>M</Type> <Code>AL</Code> <Time>1900-01-01T10:22:00</Time> </Element> </Elements> And...

How to get every attribute's name, value and parent element name in SQLXML?

Given this SQL: DECLARE @content XML SET @content = '<people> <person id="1" bimble="1"> <firstname bobble="gomble">John</firstname> <surname>Doe</surname> </person> <person id="2" bimble="11"> <firstname bobble="zoom">Mary</firstname> <surname>Jane</surname> </person> <person id="4" bimble="10"> <firstname...

SQLXML without XML encoding?

Hi, I'm using a generic system for reporting which takes data from a database view (SQL Server 2005). In this view I had to merge data from one-to-many relations in one row and used the solution described by priyanka.sarkar in this thread: Combine multiple results in a subquery into a single comma-separated value. The solution uses SQLX...

Can't find reference to SQLXML in Visual Studio 2005 SSIS Package

I had a project I was working on in Visual Studio 2008, when the requirements changed and now it needs to be done in 2005. I was using SQLXML objects from Microsoft.Data.SqlXml, but now when I downgraded I cannot find this in the add reference pop up box. Does anyone know why this isn't showing up and how I can make it show up? I trie...

Advice on how to modernize SQLXML 3.0 application

I'm hoping you can help me narrow my research on how to "modernize" my use of SQL XML... I recently "dusted off" a bit of something I cobbled together several years ago. It utilizes something called SQLXML 3.0 and IIS Virtual Directory Management for SQLXML 3.0 resulting in an XML template that contains a SQL EXECUTE of a stored procedu...

generate schemas for sql 2008 xml bulk load

hey guys i have to import large sized xml data files (some of them 500 mb in size) into sql 2008. i plan to use sqlxml bulk load for the same. however i am only interested in certain elements of the xml data file, not each and every element. my question is: in the schema file do i need to mention each and every element present in the xm...

Problem during SQL Bulk Load

Hi there, we've got a real confusing problem. We're trying to test an SQL Bulk Load using a little app we've written that passes in the datafile XML, the schema, and the SQL database connection string. It's very simple (the program is five lines, more or less) but we're getting the following error from the library we're passing this stuf...

SELECT FOR XML, How to use?

This statement below: SELECT .... FROM .... WHERE .... FOR XML PATH('Booking'), ROOT('doc') This returns all the records in one XML string. I wish for each record to have its own XML string. Does this make sense? Is it possible. Does it make sense to do this? I am using Microsoft SQL Server 2008 ...

TSQL XML Parsing

I'm calling a webservice (url below) and am getting the XML results back within SQL Server as a varchar(8000) and then converting that to XML. This works perfectly. I want to parse this XML information out into it's individual values but continue to get null values. This is my first attempt in using XML on my SQL 2008 server so I know I'...