sql读取xml
DECLARE @ItemMessage XML SET @ItemMessage=cast(N'<?xml version="1.0" encoding="utf-16"?> <A> <B id="32dcd7ee-530b-4551-8946-071934753476" value="5"> <C>1</C> </B> <B id="C7A9D074-4C82-4192-8AFB-DE89CE00E4FD" value="2"> <C>2</C> </B> </A>' as xml) SELECT T.c.value('@id','uniqueidentifier') as id, T.c.value('@value','decimal(12,5)') as value, T.c.value('(C/text())[1]','int') as c FROM @ItemMessage.nodes('A/B') AS T(c)