TechSapphire Wednesday, 2018-10-17, 12:44 PM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • --yogesh.mehla@gmail.com
    --Reading xml file using OPENROWSET
    SELECT cast(BulkColumn AS xml) FROM OPENROWSET(  
       BULK 'C:\xml\Sample.xml',  
       SINGLE_BLOB) AS x;  

    --Reading xml file using OPENROWSET from dynamic path
    DECLARE @Path VARCHAR(100)='C:\xml\Sample.xml'
    DECLARE @SQL VARCHAR(100)='SELECT cast(BulkColumn AS xml) FROM OPENROWSET(  
       BULK ' + CHAR(39) + @Path + CHAR(39) + ',  
       SINGLE_BLOB) AS x'
    EXEC(@SQL)

    --Reading xml file using OPENROWSET from dynamic path with OUTPUT variable
    DECLARE @XML XML
    DECLARE @Path VARCHAR(100)='C:\xml\Sample.xml'
    DECLARE @SQL NVARCHAR(1000)=N'SELECT @xml=cast(BulkColumn AS xml) FROM OPENROWSET(  
       BULK ' + CHAR(39) + @Path + CHAR(39) + ',  
       SINGLE_BLOB) AS x'
    exec sp_ExecuteSQL @SQL,N'@XML xml OUTPUT',@XML OUTPUT
    select @XML

    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2018