I am trying to retrieve all the GUIDs present in a particular XML Node. The XML is stored already in a column in the table. This is how it looks like
<ArrayOfString>
<string>52ddf406-00d9-v029-d748-2ee6958bdc95</string>
<string>8902ce52-00d9-vda9-afe9-0b3fa35f88b2</string>
<string>8902ce52-00d9-v919-0cb5-0b3fa1672fb3</string>
<string>8902ce52-00d9-v064-8e24-0b401390a1a7</string>
</ArrayOfString>
This is what I am trying to do
SELECT ID, Cats = XC.value('(string)[1]', 'varchar(50)')
FROM TableName
CROSS APPLY CAST(TableName AS XML).nodes('/ArrayOfString/string') AS XT(XC)
I receive the following error
Incorrect syntax near the keyword 'AS'.
I am able to retrieve any particular record. But NOT all the records at once.