SQL SERVER: Check if Node exists in XML or not08/12/2009
|Today, I have one requirement to check dynamically if a node exists in my xml or NOT.
I have a stored procedure that receives XML and I need to check if the message information xml contains one Node or NOT. If that node exists then I need to execute that Stored Procedure by different logic and if not it should run with different logic.
I figure it out by using EXISTS.
This is my XML, that I got as parameter.
DECLARE @ExportData XMLSELECT @ExportData ='<Data Number="A123"><BulkData><EachData Parts="Test1" /><EachData Parts="Test2" /><EachData Parts="Test3" /></BulkData></Data>'