Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8278571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:03:56+00:00 2026-06-08T09:03:56+00:00

I have been researching and writing/re-writing a program to do this task for a

  • 0

I have been researching and writing/re-writing a program to do this task for a week now. I need some collaboration on this to maybe bring up something I haven’t though of before. Specifically, we have an auto-generated XML file sent to us daily with ~70k records (~75MB in size.) I was asked to make a table on one of the servers (SQL) which contains this information so that it can queried. Also, this program must Update existing records (if data has changed) and Insert new records DAILY. Records must not be deleted from the db

Here is the list of methods I have attempted (so far) and reasons they did not work.

  1. SQLXMLBulkLoad – This worked excellent for importing the data.
    However, the limitation of the Bulk Load class is that it can not
    Update and/or Insert. Time for a re-write.

  2. SQL OpenRowSet (using SQLCommand, etc.) – This does not work
    because the server, program, and XML file will all 3 be on different
    computers. These devices CAN be configured to allow each other
    access to the file (specifically the server), however this method
    was deemed “Not realistic, too much overhead” Time for a re-write.

  3. DataSet Merge, then TableAdapter.Update – This method intitially
    seemed like it would definitely work. The idea is simple, use
    DataSet.XMLRead() method to put the XML data into a table in the
    dataset, then just add the SQL table to the dataset (Using
    SQLCommand, etc.), merge the two tables, and then use Table Adapter
    to Update/Insert the table into the existing SQL table. This method
    seems not to work because the XML file has two nodes (columns) which
    contains dates. Unfortunately, there is not a uniform Date datatype
    between SQL and XML. I even attempted changing all of the date
    formats from the XML file to the DateTime SQL format, which worked,
    but still deemed a datatype mismatch exception upon running.

At this point, I am out of ideas. This seems to be a task that has surely been done before. I am not necessarily looking for someone to write this code for me (I am fully capable of this), I just need some collaboration on the topic.

Thank You

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:03:58+00:00Added an answer on June 8, 2026 at 9:03 am

    We do something similar with database imports received in XML format, and all I do is pass the XML directly to a stored procedure and then shred the XML using XQuery and OPENXML.

    Both of those technologies allow you to query XML in SQL as if it was a table in your database. Taking that approach, you can just pass your XML to a script or stored procedure, query it in SQL, and insert the results wherever you need them. Anecdotally, OPENXML is better for processing large XML files, but you could try both and see how they work for you. Below is an example using OPENXML and a simple merge statement.

    create procedure ImportXml
    (
        @importXml xml
    )
    as
    --with OPENXML you have to prepare the document before you use it
    --this is unecessary with XQuery
    DECLARE @idoc int
    EXEC sp_xml_preparedocument @idoc OUTPUT, @importXml;
    
    --this is just a typical Merge statement that will update data if it exists
    --and insert it if it does not
    merge NormalDataTable
    using
    (
         --here is where you are querying the XML document directly.  You can 
         --see, it works just like a SQL statement, with a special syntax for
         --specifying where to get data out of the XML document and how to map
         --it to a table structure
         select *
         from openxml(@idoc, '/Root/Element')
         with
         (
             ElementID int '@ElementID',
             ElementValueName varchar(50) '@ElementValueName'
         ) 
    ) source
    on NormalDataTable.ElementID = source.ElementID
    when not matched then
        insert ...
    when matched then
        update ...
    
    exec sp_xml_removedocument @idoc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been researching a solution to this all week and while there have been
I need to cluster some text documents and have been researching various options. It
I have been researching this topic for a few days now and i'm still
I've been researching on how to do this for about a week now and
I have been researching this issue for a couple of weeks now. Note in
I have been researching this problem for a while now and I just can't
I have been researching all over the internet about this, and unfortunately cannot find
I have been researching this issue pretty extensively and cannot seem to find an
I have been researching this for a while but got no convinced answer. From
Sorry for the very involved question, but this is something I've been researching for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.