Showing posts with label insert using xml. Show all posts
Showing posts with label insert using xml. Show all posts

Friday, July 8, 2011

How to insert complete dataset values into sql server 2005+ using XML

First we have to convert the ds into xml and pass it to the stored

procedure.
For the sake of simplicity i created here a xml schema @xml-schema and temporary table #TempTable.


DECLARE @ixml int
DECLARE @xml-schema varchar(max)
SET @xml-schema ='





'

--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @ixml OUTPUT, @xml-schema
-- Execute a SELECT statement that uses the OPENXML rowset provider.


SELECT *
Into #TempTable
FROM OPENXML(@ixml, '/ROOT/Trans',1)
WITH
(
TransId varchar(10),
[Add] bit,
Edit bit,
[Delete] bit,
[View] bit,
Block bit
)

Select * From #TempTable

drop table #TempTable




You can change it as per your requirement . have any query please contact me rahularyansharma@gmail.com

ASP.NET Core

 Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...