SQL DB to XML file on disk

  • Hi

    Am a newbie to the world of SQL server. I need to extract all recods from a DB table (say EMployee) and create a XML file on disk.

    EMP Table --> Name, Dept , Salary. I tried the below but not sure how to write this to an XML file on disk. Any help on this is highly appreciated

    create proc [dbo].[EMPLOYEE]

    as

    declare @XmlOutput xml

    set @XmlOutput = (select name, dept, salary from dbo.EMPLOYEE

    FOR XML AUTO, ROOT('CallData'), ELEMENTS)

    select @XmlOutput AS CALL_DATA

Viewing 0 posts

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