February 26, 2009 at 4:27 am
hey can any one tell me how to read the xml data from sql server....
thanks in advance
February 26, 2009 at 4:38 am
There are various methods of doing this. One of them is explained in this KB
Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
February 26, 2009 at 5:53 am
i have a xml file at c:\sample.xml
i want to read the sample.xml file from my stored procedure how can i?
February 27, 2009 at 1:23 am
Check what Adiga is writing! The KB article explains it very nicely. Here again the link: http://support.microsoft.com/kb/316005
The input XML files (data and mapping) are referenced in the second last line: objBL.Execute "c:\customermapping.xml", "c:\customers.xml"
Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "provider=SQLOLEDB.1;data source=MySQLServer;database=MyDatabase;uid=MyAccount;pwd=MyPassword"
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "c:\customermapping.xml", "c:\customers.xml"
Set objBL = Nothing
Hope this helps.
February 27, 2009 at 2:21 am
Hi Shiva,
If you want to import an XML file purely via T-SQL, have a look at these examples:
http://msdn.microsoft.com/en-us/library/ms191184.aspx
http://weblogs.sqlteam.com/mladenp/archive/2007/06/18/60235.aspx
which explains how to import the XML data from a file into a table for further extraction
and:
http://blog.beyondrelational.com/2007/11/xml-workshop-v-reading-values-from-xml.html
which shows a basic example of how extract individual fields from the XML column data.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply