jenlion
IS-IT--Management
- Nov 13, 2001
- 215
I wrote the following query to update a table in a mysql database from sql server. I cannot figure out why this wound up updating the updatedate field for some 3000 records on the linked SQL server. It should have been the source of updated fields. I can't tell what it might have updated, if anything, unfortunately. I hope nothing, but it's got my name and 3000 updated records. Why did this hit my SQL table when I told it to update the MySQL table??
Code:
update Cust
Set CustID = C.CustID, CustName = C.CustName, CreditLimit = C.CreditLimit, PrimaryAddrKey = C.PrimaryAddrKey, DfltBillToAddrKey=C.DfltBillToAddrKey,
PrimaryCntctKey=C.PrimaryCntctKey, MasUpdateDate = C.UpdateDate
from LinkedMysqlServer...Customer Cust join LinkedSQLServer.DBName.dbo.tablename C (nolock) on Cust.CustKey = C.CustKey
where abs(datediff(s,C.UpdateDate,Cust.MasUpdatedate)) > 5