Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sjesweak
Starting Member
10 Posts |
Posted - 2007-08-16 : 12:01:40
|
| Hi all -I am wondering how I would go about updating data from one table to another entirely each night.Here's what I have so farCREATE TABLE #tempTable (KEY_ID nchar(10), BOL_NUM nchar(20), DATE_ENTER DATETIME, DATE_RCVD DATETIME, MSTR_VEND_ID nchar(10), PART_NUM nchar(10), PO_NUM nchar(10), PUR_UOM nchar(10), QTY_RCVD integer, RCVR_NUM nchar(10), SHIP_DATE DATETIME, SHIP_NUM NCHAR(10)) INSERT INTO #tempTable SELECT * FROM OPENQUERY(CMISERVER, 'SELECT KEY_ID, BOL_NUM, DATE_ENTER, DATE_RCVD, MSTR_VEND_ID, PART_NUM, PO_NUM, PUR_UOM, QTY_RCVD, RCVR_NUM, SHIP_DATE, SHIP_NUM FROM V_RPS_RCPT_MK') INSERT INTO T4M.dbo.tbl_RPS_RECEIPTS_MK SELECT * FROM #tempTable WHERE KEY_ID NOT IN ( SELECT KEY_ID FROM tbl_RPS_RECEIPTS_MK) RETURNWhat I want to do is after the insert statement has found the extra fields that have been added to then do an update to make sure all data is correct in both sources. I'm synchronizing data from a unidata database and a sql database. |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-16 : 22:35:26
|
| May use update trigger for that? |
 |
|
|
|
|
|
|
|