USE GIDWIN
GO
ALTER DATABASE GIDWIN SET TRUSTWORTHY ON
GO
IF NOT EXISTS(SELECT 1 FROM FAP_LSTG WHERE LST_GRUP = 284 AND LST_REPO = 'FCONFIMPCAU.frf')
BEGIN
	INSERT INTO FAP_LSTG(LST_GRUP, LST_NOME, LST_REPO)
	VALUES(284, 'Ficha de Conferência', 'FCONFIMPCAU.frf')
END
GO
IF NOT EXISTS(SELECT 1 FROM RGR_IC37 WHERE C37_TIPO = 'EX' AND C37_R37A = '1044' AND ISNULL(C37_R37B, '') = '' AND ISNULL(C37_R37C, '') = '' AND C37_EXPO = 1)
BEGIN
	INSERT RGR_IC37(C37_TIPO, C37_R37A, C37_R37B, C37_R37C, C37_EXPO) 
	VALUES(N'EX', N'1044', NULL, NULL, 1)
END
ELSE
BEGIN
	UPDATE RGR_IC37 SET C37_EXPO = 1 
	WHERE C37_TIPO = 'EX' AND C37_R37A = '1044' AND ISNULL(C37_R37B, '') = '' AND ISNULL(C37_R37C, '') = '' AND C37_EXPO = 0
END
GO
EXEC sp_Definicoes_ProcessaGestaoTabelasAuditoria NULL
GO
UPDATE FAP_CONF SET CFG_VERS = '17.2'
GO