SELECT FROM OpenXML not returning any data

  • I have the following challenge.

    I would like to parse XML data into a relational table.

    <NSTRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://volvo.com/vss/4_0/v1_0">

    <Header>

    <General>

    <MsgID>2d981758-3718-4ea0-8740-1f2faa788c2c</MsgID>

    <TimeStamp>2013-04-24T07:27:53.7190466Z</TimeStamp>

    </General>

    </NSTRoot>

    This is just a small part of the XML File.

    I am using the following statement:

    DECLARE @XML AS XML, @hDoc AS INT, @sql NVARCHAR (MAX)

    SELECT @XML = XMLData FROM tblTQ

    select @XML

    EXEC sp_xml_preparedocument @hDoc OUTPUT, @XML

    SELECT MsgID,TimeStamp

    FROM OPENXML(@hDoc, '/Header/General')

    WITH

    (

    MsgID Uniqueidentifier '@MsgID',

    TimeStamp datetime '@TimeStamp'

    )

    EXEC sp_xml_removedocument @hDoc

    GO

    There are no results What am i doing wrong?

    :hehe:

  • Hi,

    I think you must insert the namespace near FROM OPENXML(@hDoc, '/Header/General')

    Jon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply