Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding Idea?

Status
Not open for further replies.

jetechie

Technical User
May 23, 2006
15
US
I have a table with exist data:

USERS
---------
id
username
lname
fname
status

Every night, I get the same data with updates or new rows added into a stage table. the stage table is refreshed nightly.

USER_STAGE
----------
id
username
lname
fname
status


What would be the best method of updating my USER table with a new "status" change or new users?

Any ideas to help me get started woudl be great? Would I want to use a stored procedure using the MERGE and options of when matched do and update and when not matched, do an insert? I didnt know if there is a quicker way?

Thanks!
JE


 
JE said:
Every night, I get the same data with updates or new rows added into a stage table. the stage table is refreshed nightly.
When you say, "the same data", does this mean that the stage table contains all of the original data, changes to those data, plus new rows (, and presumably missing rows that should be deleted)?


[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
In this case, data would not be deleted. The status field would be updated to reflect invalid data. I would still have teh original data, but information could change, like a last name (someone gets married) or as I mentioned, the status would change to make that row invalid.

thanks!
JE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top