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

SET NUMERIC_ROUNDABORT OFF;



GO
PRINT N'Dropping unnamed constraint on [dbo].[T_TANTARGY]...';


GO
EXEC dev.uspDropDefaultConstraint 'T_TANTARGY', 'C_ISNINCSBELOLEORA';
GO
EXEC dev.uspDropDefaultConstraint 'T_TANTARGY', 'C_ISAMITANTARGY';


GO
PRINT N'Altering [dbo].[T_FELHASZNALOBELEPES]...';


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES]
    ADD [C_UTOLSOBELEPESMOBIL] DATETIME NULL;


GO
PRINT N'Altering [dbo].[T_NEMKOTOTTMUNKAIDO]...';


GO
ALTER TABLE [dbo].[T_NEMKOTOTTMUNKAIDO]
    ADD [C_ROGZITESDATUMA] DATETIME DEFAULT (getdate()) NOT NULL;




GO
DISABLE TRIGGER ALL ON T_NEMKOTOTTMUNKAIDO;

UPDATE T_NEMKOTOTTMUNKAIDO
SET C_ROGZITESDATUMA = CAST(CREATED AS DATE);

ENABLE TRIGGER ALL ON T_NEMKOTOTTMUNKAIDO;



GO
PRINT N'Creating unnamed constraint on [dbo].[T_TANTARGY]...';


GO
ALTER TABLE [dbo].[T_TANTARGY]
    ADD DEFAULT ('F') FOR [C_ISNINCSBELOLEORA];


GO
DISABLE TRIGGER ALL ON T_TANTARGY;

UPDATE T_TANTARGY
SET C_ISNINCSBELOLEORA = 'F';

ENABLE TRIGGER ALL ON T_TANTARGY;



GO
ALTER TABLE [dbo].[T_TANTARGY] DROP COLUMN [C_ISAMITANTARGY];



GO
PRINT N'Update complete.';


GO
EXEC dev.uspCreateSchemaViews 'T_TANTARGY,T_FELHASZNALOBELEPES,T_NEMKOTOTTMUNKAIDO';
GO


EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll
GO

ALTER QUEUE auditLog.[AuditQueue]
WITH ACTIVATION (
  STATUS = ON,
  PROCEDURE_NAME = auditLog.usp_AuditProcessing,
  MAX_QUEUE_READERS = 10,
  EXECUTE AS 'Kreta_tech_user'
);

GO
