exec sp_rename 'MASTER_ActivityStatusCode.DataId','ActivityStatusCodeId','Column' FnwtSUJ6Mg@P@fa CREATE TRIGGER [dbo].[utr_FcstOvrGroup_updatevalidation] ON [dbo].[INPUT_ForecastOvrGroupDetails] INSTEAD OF UPDATE AS BEGIN SET NOCOUNT ON; DECLARE @dataId INT, @ChangePercentage numeric(18,2), @DateFcst date, @ForecastOverGroupId date; DECLARE @currMonth int; set @currMonth = (select datepart(mm,getdate())); SELECT @dataId = INSERTED.dataId, @ChangePercentage = INSERTED.ChangePercentage, @DateFcst = INSERTED.DateFcst FROM INSERTED print datepart(mm,@DateFcst); print @currMonth; IF UPDATE(ChangePercentage) AND @currMonth = datepart(mm,@DateFcst) BEGIN --RAISERROR('Override Percentage cannot be updated for current month.', 16 ,1) ROLLBACK END ELSE BEGIN UPDATE [INPUT_ForecastOvrGroupDetails] SET ChangePercentage = @ChangePercentage WHERE DataId = @dataId END END