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 6898467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:18:00+00:00 2026-05-27T07:18:00+00:00

We need to stop populating a table with records, and just update 1 row

  • 0

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 ;
  • 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-05-27T07:18:01+00:00Added an answer on May 27, 2026 at 7:18 am

    I agree with t-clausen.dk, merge will do the insert and the update in one go.

    I think you’re looking for something like this for the update statement but it’s hard to tell without knowing what LotteryRetail.dbo.casino and @tokenResults are:

    UPDATE [testCentral].[ReplMonitor].[dbo].[replMonitor]
    SET monitorDate = @currentDateTime
        ,publicationName = @publicationToTest
        ,publicationDB = @publicationDB
        ,iteration = b.iteration
        ,tracer_id = b.tracer_id
        ,distributor_latency = b.IsNull(distributor_latency, 0)
        ,subscriber = b.subscriber
        ,subscriber_db = b.subscriber_db
        ,Loc_ID = b.b.LOC_ID
        ,subscriber_latency = b.IsNull(subscriber_latency, 0)
        ,overall_latency = b.IsNull(overall_latency, 
        IsNull(distributor_latency, 0) + IsNull(subscriber_latency, 0))
    FROM LotteryRetail.dbo.casino b
    

    This will only work correctly if [testCentral].[ReplMonitor].[dbo].[replMonitor] has only one record otherwise you will need to add a WHERE clause to limit the update to only the record you want to change.

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

Sidebar

Related Questions

I need to stop the execution Is there any procedures for using terminate and
I need to be able to start/stop a per-session GUI agent from a root
This should be simple, I need to stop any previous version of my program
We need to stop copy paste of few characters like '<' or '>' or
When developing for Android do you typically need to stop the emulator and restart
I'm running a long simulation in MATLAB that I've realized I need to stop
When writing server-side code you need to explicitly stop execution after sending a Location:
I have submitted a task using executors and I need it to stop after
I need to start and stop SQL Server from the command line. I am
I need to use deprecated stop () because I need to run Runnable classes

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.