﻿GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;

SET NUMERIC_ROUNDABORT OFF;


GO
PRINT N'Dropping [dbo].[FK_4026116_4026352]...';


GO
ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] DROP CONSTRAINT [FK_4026116_4026352];


UPDATE T_MUNKAUGYIADATOK 
	SET C_KEPESITES = 6462
WHERE ID IS NOT NULL 
AND ID NOT IN (3044, 3045, 3046, 3047, 3048)

UPDATE T_MUNKAUGYIADATOK 
	SET C_KEPESITES = 1566
WHERE ID IS NOT NULL 
AND  ID = 3044

UPDATE T_MUNKAUGYIADATOK 
	SET C_KEPESITES = 1567
WHERE ID IS NOT NULL 
AND  ID = 3045

UPDATE T_MUNKAUGYIADATOK 
	SET C_KEPESITES = 1568
WHERE ID IS NOT NULL 
AND  ID = 3046

UPDATE T_MUNKAUGYIADATOK 
	SET C_KEPESITES = 1570
WHERE ID IS NOT NULL 
AND  ID = 3047

UPDATE T_MUNKAUGYIADATOK 
	SET C_KEPESITES = 1569
WHERE ID IS NOT NULL 
AND  ID = 3048


GO
PRINT N'Creating [dbo].[FK_4026116_4026352]...';


GO
ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4026116_4026352] FOREIGN KEY ([C_KEPESITES], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_ELETPALYAMODELLFOKOZATTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Checking existing data against newly created constraints';


GO
ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] WITH CHECK CHECK CONSTRAINT [FK_4026116_4026352];


GO
PRINT N'Update complete.';


GO
