I have the following code which works fine and returns the expected results:
DECLARE @xmlList xml
SET @xmlList = '<Tx><T>1</T><T>2</T><T>3</T></Tx>'
SELECT
X.Y.value('.', 'varchar(10)') AS [ID], 'OK' AS [Status]
FROM @xmlList.nodes('/Tx/T') X(Y)
However, it also accept when I provide it with the following structure and returns the ssame results:
SET @xmlList = '<Tx><T>1</T></Tx><Tx><T>2</T><T>3</T></Tx>'
Notice how I don't have a root element.
My question is, what do I need to change to make the code accept the first structure as valid and reject the other?
Thanks,
TheBlueSky