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

  • Home
  • SEARCH
  • 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 8591073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:26:32+00:00 2026-06-11T23:26:32+00:00

I have a once-a-day ingestion case in which I will be getting a large

  • 0

I have a once-a-day ingestion case in which I will be getting a large file via FTP which contains the up-to-date versions of 4 database tables.

For each table, I would like to:

  1. Truncate table in staging database
  2. BCP the FTP’d file into that table
  3. Find diffs (IUD) between staging table and production table
  4. Make any required IUDs to production table so it matches staging table

I’m sure this is a reasonably common problem, but I’m not 100% sure as to the best way to approach it.

Are there any built in T-SQL features for this kind of problem, or do I just need to do various joins to find the inserted/updated/deleted records and execute them manually? I’m sure I can manage to do it this second way, but any suggestions are greatly appreciated none-the-less (not looking for working code).

  • 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-11T23:26:33+00:00Added an answer on June 11, 2026 at 11:26 pm

    Since nobody ever put it as a real answer, the MERGE command as mentioned by Mikael Eriksson in the comment is the right way to go, it worked great.

    Here’s a simple example usage:

    MERGE dbo.DimProduct AS Target
    USING (SELECT ProductID, ProductName, ProductColor, ProductCategory FROM dbo.StagingProduct) AS Source
    ON (Target.ProductID = Source.ProductID)
    WHEN MATCHED THEN
        UPDATE SET Target.ProductName = Source.ProductName
    WHEN NOT MATCHED BY TARGET THEN
        INSERT (ProductID, ProductName, ProductColor, ProductCategory)
        VALUES (Source.ProductID, Source.ProductName, Source.ProductColor, Source.ProductCategory)
    OUTPUT $action, Inserted.*, Deleted.*;
    

    from: http://www.bidn.com/blogs/bretupdegraff/bidn-blog/239/using-the-new-tsql-merge-statement-with-sql-server-2008

    which helped me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL server with binary logging active. Once a day logs file
I have a large data set that is updated once a day. I am
I have a PHP file that I would like to run once per day.
I have the following script which runs once a day on cron on heroku.
I have a query which results only change once a day. Seems like a
I have created a file called 'userhistoryreport.php'. It will be setup to run once
How can I make a script that, once a day, will upload a file
I have Selenium running under Cruise Control to test our site once a day.
I have a UILocalNotification that is supposed to fire once a day, Monday through
Simple question, I think. I have org.springframework.scheduling.quartz.CronTriggerBean triggering one job once a day. Because

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.