How to use MERGE or Upsert Sql statement
问题 How can i use MERGE Sql Statement or UPDATE statement for my below code. I am having a columnName called MachineName , other column values change but MachineName doesnot change. If the Column MachineName changes i need to insert the new values in a secondrow. If not i need to Update the same row. How can i do this. Is it a right approach ? Please help MERGE INTO [devLaserViso].[dbo].[Machine] WITH (HOLDLOCK) USING [devLaserViso].[dbo].[Machine] ON (MachineName = MachineName) WHEN MATCHED THEN