How can we convert XML Data to DataBase Table in C#.Net?

Answer Posted / arindamrudra

If the XML Document comes like this

@XmlDocument ='<PARAMS><STATIC><INTERVIEWDATETIME>2/13/2009</INTERVIEWDATETIME></STATIC></PARAMS>'

We will have to write

EXEC sp_xml_preparedocument @docHandle OUTPUT, @XmlDocument

@docHandle and @XmlDocument are variable of datatype int and XML respectively.


then we have to use the similar type of code to get the value from XML and the variables should be taken on the basis of the datatype coming from the XML.

DECLARE @date1 DATETIME
SELECT
@date1=Date11
FROM OPENXML(@docHandle, 'PARAMS/STATIC', 1)
WITH
(Date11 DATETIME 'INTERVIEWDATETIME')
EXEC sp_xml_removedocument @docHandle

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are c# types?

732


How do I develop c# apps?

705


What is the advantage of extension method in c#?

653


What is dapper in c#?

632


What is the difference between ref and out parameters in c#?

684


What the different phase/steps of acquiring a proxy object in webservice?

669


Name the control which cannot be placed in mdi?

671


What is yield keyword?

676


What is bit in c#?

729


How to prevent the error while updating ui control from another thread?

702


What is a Jagged Array in C#?

746


Why singleton is sealed?

646


Will the following code compile and run?

734


Difference between value and reference type. What are value types and reference types?

725


What is inheritance in csharp?

696