Merging two seperate sources

  • Hi again

    Onto my next problem which I originally thought I had sorted, but turns out it's not working the way I had assumed it was after some testing.

    Basically, I'm gathering data from two Sources, one is via XML (which is obtained from a web service and stored in a var) and the other is from querying a database. Both colums have the following columns, 'id', 'name', 'type'. The DB result set has a extra column 'bookmark'.

    What I need to do is merge the two sources into one result set. I could do this with a union, but I will result in having duplicate rows (sort of). What happens (later in the package) is that the DB is updated with any new services along with a bookmark. So when I get the xml data, it will mostly contain services that are already in the DB, but some extras that might not be there yet.

    So I need to merge the xml data and db data, with the db data taking priority if there is a duplicate and if there isn't, then the xml data is used, but a null is inserted into the output colum for the bookmark field.

    Can I do this with the tools that are availible to me, or do I have to use a script component?

    Thanks

    G

  • I think it should work using a FULL JOIN, COALESCE(DB.item, XML.item) all items and use the bookmark from the DB table.

    If you need further help, please post the table description in the way described in the article and the end of this post.

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

Viewing 2 posts - 1 through 1 (of 1 total)

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