importing xml file

  • Dear All,

    i want to import xml file into sql server 200.i want to  write proc for this which will use filename(stream) as input parameter.My file size is currently 3.5 MB which goes on increasing.I tried with input parameter of datatype as text.but while executing it is not taking filename as stream.

    Can anyone help me in this issue.

     

     

  • A proc will not directly take a stream as an import mechanism. It will take text and you'd need to somehow get your file loaded into memory and then pass in as a parameter.

    Alternatively, you could use some type of bulk copy insert to load into a table and then manipulate it from there.

  • Try the link below for sample code using OPENXML and you can use both Excel and Word and save the file  as XML.   Hope this helps.

    http://msdn.microsoft.com/msdnmag/issues/05/06/DataPoints/default.aspx

    Kind regards,

    Gift Peddie

    Kind regards,
    Gift Peddie

  • For loading significant amounts of xml I would strongly suggest investigating SQLXML.

    Put simply, create a xml schema defining the xml document and the related database tables, then execute a script to create a SQLXML instance and bulk load. Performance is not too far away from BCP and also enable inserts into related table with dynamically created identity values.

    I've got some sample schema/script if you get stuck.

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

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