how to read a xml file on local file system

  • Hi,

     i have a xml file c:\abcd.xml in my local filesystem.. i just want to

    take the path as in parameter for a stored procedure and insert the values

    into a table type variable

     execute usp_xx (@xmlpath='c:\abcd.xml')

       -- inside the sp i would like to read the xml file and insert the same

    into a table type variable..

    Can anyone tell me the idea..

    nsr

  • you will be using some language to execute that stored procedure, so read the xml file into object of xmldocument and then convert the information from xmlfile to string and pass this string onto the stored procedure, this will be much easier.

    from

    panwar_satish@rediffmail.com

  • There are a number of ways to import xml into sql server. Personally, I favour the approach of using ado to retrieve the data into a recordset and then populate my tables. I learnt how to do this from:

    http://www.perfectxml.com/articles/xml/importxmlsql.asp

    The other method I looked at was the link below:

    http://support.microsoft.com/?scid=316005

    However, I decided against this approach because of the need to coinfigure the server. I have enough problems as it is with the dba's in my company, without having to ask for installations.

    I would think this second method is more to your requirements.

    Unfortunatley, you can see that both approaches take a fair amount of time to implement. I only undertook the task because I was asked to do so.

    In my own opinion, I think that xml is one of the worst things to come out EVER. I can see no point in using it; There is always a better solution. It cannot cope with relational data, is a pain in the backside to get in and offers very little benefit in getting out. It is easier to write a normal sql statement and then do something with the data.

    The whole point of xml was to create a universally exchangeable way of storing information. Hello! Has anyone ever heard of text files?

    Therefore, I would suggest that you find an alternative way of storing information if you can. Good luck.

     

     


    ------------------------------
    The Users are always right - when I'm not wrong!

  • hello dear,

    there exist some ERP (CRM for example) from which you will always get data in xml , you can't get in any other format, so to me it seems that openxml is the best way to do this job. i had been able to do it and is using it in my application.

    from

    Satish Panwar

    panwar_satish@rediffmai.com

     

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply