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

Does c# have a 'throws' clause?

575


Can a struct inherit from an interface in c#?

513


Difference between call by value and call by reference in C#?

518


Should I use double or float?

498


How do you escape c#?

504






What is the difference between new and override in c#?

552


Tell us something about static linking and dynamic linking?

529


What is access specifier in c#?

565


Is php better than c#?

495


What is difference between method and function in c#?

470


What method is used to sort the elements of the array in descending order?

566


Is array ienumerable c#?

467


Does c# support multilevel inheritance?

483


Which framework is best for desktop application?

520


What is the adv of using System.Text.StringBuilder over System.String?

532