Looking for SQL Code

  • Hi

    I am having situation where I would like to update the existing data before inserting any new record. It records are two in row, update both but if they are not , then I don't need to update again.

    In below example,  I am inserting data for process ID 3 with process status 2.. But Since FailedNumber is already exist in ProcessTable & His status was 1  and I would like to update his status to 2 for processID 1 & 2 . Once the data updated and inserted,, there is another process that will change status to 1(after another process run).

     

    There is another situation where I am inserting data for peocessID 3.. While inserting the data for process ID 3.. I am looking for Previous Process ID with failedNumber.. Since ProcessID 2 is not exist, I don't want to update process status to 2 for ProcessID = 1

    Let me know if you need more explanation.

    Thanks

    Bhavesh

     

     

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Didn't you get some answers, and more questions, in this thread?

    https://www.sqlservercentral.com/forums/topic/looking-for-sql-code

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • Thanks. It was duplicate due to internet issue.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply