IF (SELECT DATEDIFF(year, '2016-01-01', dSubmittedDate) FROM LicenseManager01_Dat.[dbo].[tblDts] WHERE nID=5) = 0
BEGIN
	UPDATE LicenseManager01_Dat.dbo.tblDts SET dSubmittedDate=DATEADD(YEAR, 1, dSubmittedDate) WHERE nID<10000
	UPDATE LicenseManager01_Dat.dbo.tblDts SET dLastUpdateDate=DATEADD(YEAR, 1, dLastUpdateDate) WHERE nID<10000
	UPDATE LicenseManager01_Dat.dbo.tblDts SET dAssignedDate=DATEADD(YEAR, 1, dAssignedDate) WHERE nID<10000
	UPDATE LicenseManager01_Dat.dbo.tblDts SET dClosedDate=DATEADD(YEAR, 1, dClosedDate) WHERE nID<10000
	UPDATE LicenseManager01_Dat.dbo.tblRevisionHistory SET dDate=DATEADD(YEAR, 1, dDate) WHERE nRecordID<10000
END 
GO

IF (SELECT DATEDIFF(year, '2016-01-01', dSubmittedDate) FROM [Purchases&Agreements01_Dat].[dbo].[tblDts] WHERE nID=1009) = 0
BEGIN
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET dSubmittedDate=DATEADD(YEAR, 1, dSubmittedDate) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET dLastUpdateDate=DATEADD(YEAR, 1, dLastUpdateDate) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET dAssignedDate=DATEADD(YEAR, 1, dAssignedDate) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET dClosedDate=DATEADD(YEAR, 1, dClosedDate) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET Invoice_Date=DATEADD(YEAR, 1, Invoice_Date) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET [Start_Date]=DATEADD(YEAR, 1, [Start_Date]) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET End_Date=DATEADD(YEAR, 1, End_Date) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET Ordered_Date=DATEADD(YEAR, 1, Ordered_Date) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET Received_Date=DATEADD(YEAR, 1, Received_Date) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblDts SET Approved_Date=DATEADD(YEAR, 1, Approved_Date) WHERE nID<10000
	UPDATE [Purchases&Agreements01_Dat].dbo.tblRevisionHistory SET dDate=DATEADD(YEAR, 1, dDate) WHERE nRecordID<10000
END 
GO

IF (SELECT DATEDIFF(year, '2015-01-01', dSubmittedDate) FROM HelpDesk01_Dat.[dbo].[tblDts] WHERE nID=1) = 0
BEGIN
	UPDATE HelpDesk01_Dat.dbo.tblDts SET dLastUpdateDate=DATEADD(YEAR, 1, dLastUpdateDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET dAssignedDate=DATEADD(YEAR, 1, dAssignedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET dClosedDate=DATEADD(YEAR, 1, dClosedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET [Planned$Start$Date]=DATEADD(YEAR, 1, [Planned$Start$Date]) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET [Planned$End$Date]=DATEADD(YEAR, 1, [Planned$End$Date]) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET Activity$Log=REPLACE(Activity$Log, '/2017', '/2018') WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET Activity$Log=REPLACE(Activity$Log, '/2016', '/2017') WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET Activity$Log=REPLACE(Activity$Log, '/2015', '/2016') WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblRevisionHistory SET dDate=DATEADD(YEAR, 1, dDate) WHERE nRecordID<10000 AND (SELECT dSubmittedDate FROM HelpDesk01_Dat.dbo.tblDts AS B WHERE tblRevisionHistory.nRecordID=B.nID) <'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET dSubmittedDate=DATEADD(YEAR, 1, dSubmittedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET dTargetIRT=DATEADD(YEAR, 1, dTargetIRT) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE HelpDesk01_Dat.dbo.tblDts SET dTargetClosureTime=DATEADD(YEAR, 1, dTargetClosureTime) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
END
GO

IF (SELECT DATEDIFF(year, '2013-01-01', dSubmittedDate) FROM Roles01_Dat.[dbo].[tblDts] WHERE nID=1) = 0
BEGIN
	UPDATE Roles01_Dat.dbo.tblDts SET dClosedDate=DATEADD(YEAR, 1, dClosedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Roles01_Dat.dbo.tblDts SET dLastUpdateDate=DATEADD(YEAR, 1, dLastUpdateDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Roles01_Dat.dbo.tblRevisionHistory SET dDate=DATEADD(YEAR, 1, dDate) WHERE nRecordID<=10000 AND (SELECT dSubmittedDate FROM Roles01_Dat.dbo.tblDts AS B WHERE tblRevisionHistory.nRecordID=B.nID) <'2018/01/01'
	UPDATE Roles01_Dat.dbo.tblDts SET dSubmittedDate=DATEADD(YEAR, 1, dSubmittedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
END
GO

IF (SELECT DATEDIFF(year, '2013-01-01', dSubmittedDate) FROM Actions01_Dat.[dbo].[tblDts] WHERE nID=1) = 0
BEGIN
	UPDATE Actions01_Dat.dbo.tblDts SET dLastUpdateDate=DATEADD(YEAR, 1, dLastUpdateDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Actions01_Dat.dbo.tblDts SET dAssignedDate=DATEADD(YEAR, 1, dAssignedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Actions01_Dat.dbo.tblDts SET dClosedDate=DATEADD(YEAR, 1, dClosedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Actions01_Dat.dbo.tblRevisionHistory SET dDate=DATEADD(YEAR, 1, dDate) WHERE nRecordID<10000 AND (SELECT dSubmittedDate FROM Actions01_Dat.dbo.tblDts AS B WHERE tblRevisionHistory.nRecordID=B.nID) <'2018/01/01'
	UPDATE Actions01_Dat.dbo.tblDts SET dSubmittedDate=DATEADD(YEAR, 1, dSubmittedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
END
GO
	

IF (SELECT DATEDIFF(year, '2013-01-01', dSubmittedDate) FROM Resources01_Dat.[dbo].[tblDts] WHERE nID=1) = 0
BEGIN
	UPDATE Resources01_Dat.dbo.tblDts SET dLastUpdateDate=DATEADD(YEAR, 1, dLastUpdateDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET dAssignedDate=DATEADD(YEAR, 1, dAssignedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET dClosedDate=DATEADD(YEAR, 1, dClosedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Delivery_Date=DATEADD(YEAR, 1, Delivery_Date) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Last_Imported_Date=DATEADD(YEAR, 1, Last_Imported_Date) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Purchased_Date=DATEADD(YEAR, 1, Purchased_Date) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Request_Required_By_Date=DATEADD(YEAR, 1, Request_Required_By_Date) WHERE 7183<=16 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Requested_Until=DATEADD(YEAR, 1, Requested_Until) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Retired_Date=DATEADD(YEAR, 1, Retired_Date) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Warranty_Start_Date=DATEADD(YEAR, 1, Warranty_Start_Date) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET Warranty_Until=DATEADD(YEAR, 1, Warranty_Start_Date) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblRevisionHistory SET dDate=DATEADD(YEAR, 1, dDate) WHERE nRecordID<10000 AND (SELECT dSubmittedDate FROM Resources01_Dat.dbo.tblDts AS B WHERE tblRevisionHistory.nRecordID=B.nID) <'2018/01/01'
	UPDATE Resources01_Dat.dbo.tblDts SET dSubmittedDate=DATEADD(YEAR, 1, dSubmittedDate) WHERE nID<10000 AND dSubmittedDate<'2018/01/01'
END
GO

