<?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight Rain</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-12-16</publish_date> <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description> </book> </catalog>
I have xml file as above.
In my SQL Server 2008 database there is table
Book__Master In which all the columns are same as elements in above xml file i.e. there are columns like
Now I want to write a stored procedure which accepts this xml file as input parameter and stores the element's values as it is in their respective columns.
Can anyone help me on this that how I can write this type of stored procedure?