Using XML Data Type in SQL Server 2005...

  • Hi

    Here is a sample code which creates a stored procedure and executes the xml against that in query analyzer. Just follow the steps and modify the code as it suits to you once u throogh the output.

    1) Create Procedure...

    CREATE PROCEDURE [dbo].[Study_SaveData](

    @studyDataXML XML

    )

    AS

    BEGIN

    SELECT StudyTab.StudyCol.value('StudyParID[1]','int') AS StudyParID,

    StudyTab.StudyCol.value('TPID[1]','int') AS TPID,

    StudyTab.StudyCol.value('DataValue[1]','float') AS DataValue

    FROM @studyDataXML.nodes('//StudyDataList/StudyData') AS StudyTab(StudyCol)

    END

    2) Run the procedure like this.......

    EXEC [dbo].[Study_SaveData]

    '

    '

    bingo ........ go ahead and modify the code to suite your needs.

    Regards

    Srinivas Chilakapati

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

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