Database Migration, Comparision and Synchronization Tools
Got a SQL Server or .NET question? Discuss it in the forums. (SQL Server Forums | Dot NET Forums)
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

XQuery Lab 62 – Revisiting simple TSQL SELECT operations using XQuery

This post aims to be a quick reference source for the beginners and shows a few simple SELECT examples....

XQuery Lab 61 – Writing a Recursive CTE to process an XML document

We have seen several examples of writing recursive queries in the earlier blog posts. For a quick recap, you can find some of those posts in the list given below. TSQL Lab 10 - Performing recursive updates in SQL Server TSQL Lab 11 - Writing a recursive...

XQuery Lab 60 – Executing dynamic query strings with OPENXML()

This installment of XQuery Lab shows how to execute dynamic queries that contain OPENXML() calls. We will see examples that use EXEC() and sp_executesql...

Using the XMLTable() Function

A few weeks back, I published a function named XMLTable() that helps to query XML documents easily. The idea behind the function is to be able to blindly query XML documents just like you do a ‘SELECT *’ on a relational table. Not only that this function...

XQuery Lab 59 – OPENXML() and XML Namespace Declarations

In the previous post , we saw a basic example that reads information from an XML document using OPENXML(). In this post, we will focus on reading information from XML documents having namespace declarations. Here is a simple example: DECLARE @x VARCHAR...

XQuery Lab 57 – Getting Started with OPENXML

This post intends to help you get started with OPENXML() function. OPENXML() lets you shred an XML document or fragment into a result set. Though OPENXML() has got no direct relationship with XQuery, I thought of including it in the XQuery Labs series...

XQuery Lab 56 – Inserting elements with UNICODE values

This post explains how to write XML DML queries uisng XQuery in TSQL that deals with UNICODE character strings....

XQuery Lab 58 - SELECT * FROM XML

Most people find it very difficult to deal with XML documents in TSQL as there is no way to run a ‘blind’ SELECT * query on an XML document to get a quick view of the content stored in it. A “select TOP N *” query can quickly give you a few records from...

XQuery Lab 55 – Extracting values from XML elements that matches a string pattern

Here is another XQuery exercise that uses the contains() function to match a string pattern against an XML element and retrieves values from a sibling element. Here is the input data for this challenge. <ArrayOfCustomField> <CustomField> <Name>abc<...

XQuery Lab 54 – Modifying an XML document with a SELECT Query

This post explains how to modify an XML document from a SELECT query in TSQL...

XQuery Lab 53 – Reading information from SQL Server Extended Event Information XML

This installment of XQuery Labs explains how to read information from the XML document generated by SQL Server Extended Events....

XQuery Lab 52 – A More Intuitive way of reading an RDF document

After reading XQuery Lab 51 , my friend and database expert Brad Schulz send me a note showing another way of achieving the same results. The approach he suggested was much cleaner than my version. My code used the following expression in the WHERE clause...

XQuery Lab 51 – Querying an RDF document using TSQL and XQuery

This installment of XQuery Labs presents a script that reads information from an RDF document using TSQL and XQuery....

XQuery Lab 50 – Reading data from Google Analytics Atom Feed

One of my friends emailed me this morning asking help for reading data from Google Analytics Atom feed, using Query with TSQL. My friend sent me a sample XML document he obtained from Google Analytics and here is the query that reads information from...

XQuery Lab 49 – Deleting rows from a table based on the data in an XML document

We have seen a few examples that demonstrated how to delete elements and attributes from XML documents. In this lab, let us see how to delete rows from a table, based on the data in an XML document. DECLARE @t TABLE (id INT ) INSERT INTO @t(id) SELECT...
More Posts Next page »

Copyright © Beyondrelational.com