USE [LicenseManager01_Dat]
GO

IF EXISTS (SELECT nID FROM [tblDts] WHERE nID = 5 and nSubstateID = 7 and nStateID = 2 and Available_Licenses = 13 and Compliance__ = 52 and Allocation_Type IS NULL and Used_Licenses = 12)
BEGIN
UPDATE [dbo].[tblDts] SET [nSubstateID]=15, [nStateID]=1, [Available_Licenses]=12, [Compliance__]=48, [Allocation_Type]=2, [Used_Licenses]=13 WHERE [nID]=5
END
GO

IF EXISTS (SELECT nID FROM [tblDts] WHERE nID = 11 and Type_of_Keys = 5 and Allocation_Type IS NULL)
BEGIN
UPDATE [dbo].[tblDts] SET [Type_of_Keys]=2, [Allocation_Type]=1 WHERE [nID]=11
END
GO

IF EXISTS (SELECT nID FROM [tblDts] WHERE nID = 13 and nSubstateID = 7 and nStateID = 2 and Allocation_Type IS NULL)
BEGIN
UPDATE [dbo].[tblDts] SET [nSubstateID]=15, [nStateID]=1, [Allocation_Type]=2 WHERE [nID]=13
END
GO

IF EXISTS (SELECT nID FROM [tblDts] WHERE nID = 14 and nSubstateID = 7 and nStateID = 2 and Allocation_Type IS NULL)
BEGIN
UPDATE [dbo].[tblDts] SET [nSubstateID]=15, [nStateID]=1, [Allocation_Type]=2 WHERE [nID]=14
END
GO

IF EXISTS (SELECT nID FROM [tblDts] WHERE nID = 23 and nSubstateID = 7 and nStateID = 2 and Allocation_Type IS NULL)
BEGIN
UPDATE [dbo].[tblDts] SET [nSubstateID]=15, [nStateID]=1, [Allocation_Type]=2 WHERE [nID]=23
END
GO
