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

  • SEARCH
  • Home
  • 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 4250472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:31:59+00:00 2026-05-21T04:31:59+00:00

IF NOT EXISTS(SELECT * FROM dbo.com_project_transaction_link WHERE pt_tr_transaction_id = @transactionId AND pt_pj_project_id = @projectId)

  • 0
IF NOT EXISTS(SELECT * FROM dbo.com_project_transaction_link 
  WHERE pt_tr_transaction_id = @transactionId 
  AND pt_pj_project_id = @projectId)
BEGIN
  INSERT INTO dbo.com_project_transaction_link(pt_tr_transaction_id, pt_pj_project_id) 
   VALUES (@transactionId, @projectId)
END

I want to fix this proc. Right now, if it DOESN’T find a record that has the passed in projectId AND transactionId, it will insert it. I want to make this so if it finds the transactionId at ALL, it will perform an update with the new projectId, however if it doesn’t find it, it will do what it does now.

Can I grab some help 🙂

Thanks!

  • 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-21T04:32:00+00:00Added an answer on May 21, 2026 at 4:32 am

    This should get you started:

    IF EXISTS(SELECT * FROM dbo.com_project_transaction_link 
     WHERE pt_tr_transaction_id = @transactionId)
    BEGIN
      UPDATE ...
    END
    ELSE
    BEGIN
      INSERT...
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

IF NOT EXISTS(SELECT * FROM SYS.COLUMNS WHERE Name=N'isHidden' AND Object_ID=Object_ID(N'Templates')) BEGIN BEGIN TRANSACTION GO
here is the query SELECT * FROM customers WHERE NOT EXISTS ( SELECT 1
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
SELECT TradeId, Trade_SecurityId, SecurityType.*, Trade_ParAmount Quantity INTO #Securities FROM Fireball.dbo.PreAssignSecurityType SecurityType INNER JOIN Fireball_RawImportData.dbo.Import_WSO_TradeReport
I'm trying to do the following: IF NOT EXISTS ( SELECT * FROM [tbl_web_company]
Is the following problematic? DELETE a FROM WHAnalysis.dbo.tb_r12027dxi_CalculatedData a WHERE EXISTS ( SELECT *
Ok, so you have something like this working. You Insert into a table from
--Stored procedure ALTER PROCEDURE [dbo].[Test] @USERID varchar(25) AS BEGIN SET NOCOUNT ON IF NOT
Below statement will return values from OpenQuery(MYSQL). Select * From OpenQuery(MYSQL, 'Select * From
i have this query but this shows column does not exist SELECT p.content, (select

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.