title: MERGE with UPSERT, not inserting any value in table
body: <p>Table structure:</p>
  
  <pre><code>CREATE TABLE [dbo].[LockOfferByOfferUses](
  [OfferID] [int] NULL,
  [OfferCode] [varchar](50) NULL,
  [LockCounter] [int] NULL,
  [UpdatedDate] [datetime] NULL
  ) ON [PRIMARY]
  </code></pre>
  
  <p>SQL statemnt:</p>
  
  <pre><code>merge into LockOfferByOfferUses as Target
  using (Select * from LockOfferByOfferUses Where OfferID=123 And OfferCode='abc' ) as Source
  on Target.OfferID = Source.OfferID
  when NOT MATCHED then
  INSERT (OfferID,OfferCode,LockCounter,UpdatedDate) VALUES (123,'abc',1,GETDATE())
  when MATCHED then 
  update set Target.LockCounter=Target.LockCounter+1;
  </code></pre>
  
  <p>What i m trying to do is, check if a record exists in "LockOfferByOfferUse" by the offerID. If it doesn't exist, insert a record; If exists update "LockCounter" column.</p>
  
  <p>The update part works, but the insertion isn't working. It's displaying message "(0 row(s) affected)". No error message.</p>
  
  <p>Would really appreciate some help.</p>