December 6, 2021 at 5:29 pm
Hi there
I am trying to the Channel list from a particular XML file in lines 868 - 872 (Instrumental Channel List)
Now i tried the following
DECLARE @DataSheetXML XML
-- Extract Datasheet, so that Probe Definition and Channel List can be extractted
SELECT @DataSheetXML = DataSheetXML from [#DeviceMasterList]
SELECT
pd.a.value('let $a := . return 1 + count(../ProbeDefinition[. << $a])', 'int') AS [MPRowID],
NEWID() AS [MeasuringPointEntryChannelID],
cl.b.value('.','int') AS [ChannelID]
FROM
@DataSheetXML.nodes('Datasheet/InstrumentationChannelList') AS pd(a)
CROSS APPLY pd.a.nodes('InstrumentationChannelList/int') cl(b)
#
But couldnt extract the ChannelList
What am I doing wrong?
Attached are the following:
TIA
December 6, 2021 at 6:56 pm
Please try renaming your XML file as .TXT and attaching again. Some file types are blocked.
December 7, 2021 at 10:08 am
I created a temp table and inserted your XML doc into it. The following code worked for me
SELECT ChannelId = v.n1.value('(.)[1]', 'INT')
FROM #SomeXML sx
CROSS APPLY sx.X.nodes('Datasheet/InstrumentationChannelList/int') v(n1);
December 7, 2021 at 11:43 am
Hi Phil
Brilliant. That works very well. Thank you very much for your help
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy