XML

  • DECLARE @Employee AS Table (SlNo INT,Name VARCHAR(500),Salary MONEY)

    DECLARE @XML AS xml

    DECLARE @IDoc INT

    SET @XML = NULL

    INSERT INTO @Employee values(1,'Antony',10000)

    INSERT INTO @Employee values(2,'Agent',40000)

    INSERT INTO @Employee values(3,'Master',50000)

    SET @XML = (SELECT SlNo,Name,Salary FROM @Employee Emp FOR XML Auto, Root('COMPANY'),elements)

    Exec Sp_Xml_PrepareDocument @IDoc Output, @XML

    SELECT SlNo,Name,Salary FROM OpenXMl (@iDoc,'/Company/Emp',2)

    WITH(SlNo INT,Name VARCHAR(500),Salary MONEY)

    EXEC sp_xml_removedocument @IDoc

    When i selecting , it returns no row. Why ? Plse Help me...

  • Thats the QotD from Wednesday.

    Have you answered the question yet? If so it tells you why you get no results.

  • *it's somewhere in the OpenXML statement*

    :pinch:

    MCITP: Database Administrator 2005
    MCTS SQL Server 2008
    MCP SQL 2012/2014
    MCSA SQL Server 2012/2014
    MCSE Data Management and Analytics

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

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