|
|
-
|
|
Some times you might need to retrieve the XML element at a given position. It may be because you are running a loop over all the elements of the XML document to perform some application specific operations or you want to pass those elements to another application/stored-procedure/function et......
|
|
-
|
|
This is one of the requirements we came across, while writing the TSQL function to compare two XML values. In one of the previous posts, we saw how to find the name and value of attributes at a specified location. We then saw how to find the number of attributes an element has. So, we have......
|
|
-
|
|
You can check the existence of an attribute by using the "exist" method of the XML data type. The following example checks if the "Name" attribute exists in the "Employee" element. DECLARE @x1 XMLSELECT @x1 = ''IF @x1.exist('/Employee/@N......
|
|
-
|
|
In the previous post we saw how to find the value of an attribute at a specified position. In this post, we will see how to find the name of an attribute at a specified position. Here is the XML instance we will use for this lab. Employees Dept<span style="color:......
|
|
-
|
|
It is easy to read the value if we know the name of the attribute. In this post we will examine how to read the value of an attribute at a given position. We will use the same XML instance we examined in the previous post. Employees Dept<span style="color: #0000ff......
|
|
-
|
|
The first time I came across this question is when I started writing the TSQL function to compare two XML values. Let us see how to count the attributes an element has. Here is the XML value that we will use for the examples in this lab. Employees Dept<span style=......
|
|
-
|
|
Well, this is yet another question we need to answer before we could write the TSQL function to compare two XML values. Let us look at an XML instance. Employees><br /> Employee<span s......
|
|
-
|
|
Most of the times we need only to read values from elements. However, there may be times when you need to read the name of elements as well. We came across this requirement when we started writing the TSQL function that compares two XML values, in the previous post. The following example sh......
|
|
-
|
|
It is easy to read information when we know the name of the element to be processed. In this post, let us examine how to read values from elements using wildcards. This is one of the functionality we needed to write the function we wanted to write in the previous post, to compare two XML val......
|
|
-
|
|
Many people asked me if there is a to compare two XML values in TSQL. And my answer always was "there is not support in TSQL". Comparing two XML values is not very easy. Some people suggest using a CHECKSUM() but that does not seem to be giving correct results. Position of attrib......
|
|