Update and Insert When Condition is Matched in TSQL-Merge
问题 I have been trying to Write a Stored Procedure where i can perform UpSert using Merge with the Following Condition If Record is Present then change EndDate of Target to Yesterday's day i.e., Present Day - 1 If Record is not Present then Insert New Record Here is the Table tblEmployee i used in SP CREATE TABLE tblEmployee ( [EmployeeID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](10) NOT NULL, [StartDate] [date] NOT NULL, [EndDate] [date] NOT NULL ) Here is my SP which Takes UDTT as Input