SQL Server - OPENXML how to get attribute value

Posted by DotnetDude on Stack Overflow See other posts from Stack Overflow or by DotnetDude
Published on 2009-03-20T21:32:38Z Indexed on 2010/04/23 20:53 UTC
Read the original article Hit count: 402

Filed under:
|
|

I have the following XML:

<Field FieldRowId="1000">
    <Items>
        <Item Name="CODE"/>
        <Item Name="DATE"/>
    </Items>
</Field>

I need to get the FieldRowId using OPENXML. The SQL i have so far:

INSERT INTO @tmpField
      ([name], [fieldRowId])
SELECT [Name], --Need to get row id of the parent node
 FROM OPENXML (@idoc, '/Field/Items/Item', 1)

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server