We need to stop populating a table with records, and just update 1 row per record repeatedly. There is no need to maintain any history. I've worked with this UPDATE statement but can't get the right syntax to take into account the JOIN as well.
Can anyone help with making this INSERT INTO a simple UPDATE? I will then add IF EXISTS (do the UPDATE) ELSE (do the insert) once I figure out the syntax of the UPDATE statement. I'm using a excellent script by sqlfool.com, but have made several modifications and I hope this is the last one. Thank you !!
Insert Into [testCentral].[ReplMonitor].[dbo].[replMonitor]
(
monitorDate
, publicationName
, publicationDB
, iteration
, tracer_id
, distributor_latency
, subscriber
, subscriber_db
, Loc_ID
, subscriber_latency
, overall_latency
)
Select
@currentDateTime
, @publicationToTest
, @publicationDB
, iteration
, tracer_id
, IsNull(distributor_latency, 0)
, subscriber
, subscriber_db
, b.LOC_ID
, IsNull(subscriber_latency, 0)
, IsNull(overall_latency,
IsNull(distributor_latency, 0) + IsNull(subscriber_latency, 0))
From @tokenResults AS a
JOIN LotteryRetail.dbo.casino b
ON 1 = 1 ;