SQL Server XQuery: MORE deleting nodes using .modify()

So after my last post, my developer friend came back to me and noted that I hadn’t really demonstrated the situation we had discussed; our work was a little more challenging than the sample script I had provided.  In contrast to what I previously posted, the challenge was to delete nodes where a sub-node contained […]

March 13, 2014 · stuart · No Comments
Tags: , ,  · Posted in: SQL Server, SQLServerPedia Syndication, XML

SQL Server XQuery: deleting nodes using .modify()

Quick blog post; got asked today by a developer friend of mine about how to delete nodes in an XML fragment using the .modify() method.  After some head-scratching and some fumbling around (its been a few months since I’ve done any work with XML), we came up with a version of the following script: DECLARE […]

March 10, 2014 · stuart · No Comments
Tags: , ,  · Posted in: SQL, SQL Server, SQLServerPedia Syndication, XML

quick blog from #sqlpass #summit13

Been a busy couple of days; hell, the last few weeks have been just nuts. I’m pausing for a few seconds to type a quick post from sunny Charlotte, and just fill in a few thoughts. First, I think my XQuery session went reasonably well; I got bit by the demo gods, and shouldn’t have […]

October 17, 2013 · stuart · 4 Comments
Tags: , , ,  · Posted in: PASS, SQL Server, SQLServerPedia Syndication

SQL Server XQuery: Functions (sql:variable() & sql:column())

  Like most query languages, XQuery has several functions that can be used to manipulate and query data.  SQL Server’s implementation supports a limited subset of the XQuery specification, but there’s a lot of power in the functions provided.  I hope to cover some of those functions in more detail at a later date, but […]

October 4, 2013 · stuart · No Comments
Tags: , ,  · Posted in: SQL, SQL Server, SQLServerPedia Syndication, XML

SQL Server XQuery: .modify() method

Continuing with XQuery, today’s post addresses the .modify() method against the xml data type; this method is used to update XML documents by applying one of three XML DML statements (insert, delete, or replace) via the use of a SQL SET statement.  Again, the idea is hand off the work between the XML engine and […]

October 3, 2013 · stuart · No Comments
Tags: , ,  · Posted in: SQL, SQL Server, SQLServerPedia Syndication, XML

SQL Server XQuery: .nodes() method

Revisiting my XQuery discussion that I abandoned so long ago; with PASS Summit 2013 quickly approaching, I need to get back on the stick, and make some headway in this series.  The .nodes() method is different than the other xml methods in SQL Server in that it: returns tabular data, and so must be used […]

September 30, 2013 · stuart · No Comments
Tags: , ,  · Posted in: SQLServerPedia Syndication

SQL Server XQuery: .value() method

Back to XQuery; the third method I wanted to discuss in this series is the .value() method. Like the .query() method, .value() bridges the SQL Server database engines and XQuery engines by extracting information from an XML document.  The difference is that while .query() returns XML, .value() translates the specific information requested into a scalar […]

July 17, 2013 · stuart · One Comment
Tags: , ,  · Posted in: SQL, SQLServerPedia Syndication, XML

SQL Server XQuery: .query() method

Continuing in my discussion of XQuery in SQL Server, let me discuss another XML data type method: .query().  The .query() method is a great illustration of the bridging concept I discussed earlier.  Simply put, this method allows you to run an XQuery against the XML data type, and return the results of that query as […]

June 24, 2013 · stuart · One Comment
Tags: , ,  · Posted in: SQL Server, SQLServerPedia Syndication, XML

SQL Server & XQuery: XPath Axes, Node Tests, and Predicates

In order to really get a grasp on what’s going on within an XQuery method in SQL Server (like .exist()), we need to examine the relationship between XQuery and XPath.  Semantically, there’s little difference in the usage of the two names, since XQuery as a language uses XPath to navigate through an XML fragment; however, […]

June 20, 2013 · stuart · No Comments
Tags: , ,  · Posted in: SQL Server, SQLServerPedia Syndication, XML

SQL Server XQuery: .exist() method

I’m trying to beef up my writing about XQuery in advance of the upcoming PASS Summit 2013; I got accepted to present, and I want to make sure that I start covering a lot of topics related to XML so that I’ve honed my focus a bit.  Unfortunately, blogging doesn’t come easy to me these […]

June 19, 2013 · stuart · No Comments
Tags: , ,  · Posted in: SQL Server, SQLServerPedia Syndication, XML