0

I am trying to create a stored procedure for insert/update in a very single call

Here is my start :

CREATE PROCEDURE [dbo].[OutlookDataInsert] 
    @transactionID VARCHAR(100) = NULL,
    @jsonRequest NVARCHAR(MAX) = NULL,
    @jsonResponse NVARCHAR(MAX) = NULL
AS
    SELECT transactionID  
    FROM dbo.OutlookData 
    WHERE @transactionID IS NULL 
       OR transactionID = @transactionID

I want to check if transactionID exists and already in the database table, I should do an update, else it should do an insert. I am getting lost in the if else clause and a checkpoint as to how should I do this task?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
cf-uuser
  • 23
  • 4

0 Answers0