BEGIN TRANSACTION SET QUOTED_IDENTIFIER ON SET ARITHABORT ON SET NUMERIC_ROUNDABORT OFF SET CONCAT_NULL_YIELDS_NULL ON SET ANSI_NULLS ON SET ANSI_PADDING ON SET ANSI_WARNINGS ON COMMIT BEGIN TRANSACTION GO ALTER TABLE dbo.Import_appstate ADD cancellation_date datetime NULL GO ALTER TABLE dbo.Import_appstate SET (LOCK_ESCALATION = TABLE) GO COMMIT update Import_appstate set cancellation_date= (select creattime from import_main m where m.contractno=Import_appstate.contractno) where Import_appstate.cancellation=1