IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE NAME = 'CG_FND_VERBA_FECH_CONTAB')
BEGIN
	CREATE TABLE [dbo].[CG_FND_VERBA_FECH_CONTAB](
		[CD_EMP] [int] NOT NULL,
		[DATA_FECHAMENTO] [DATE],
		[CD_USU] [int] not NULL,
		[DT_FECH] [date] NOT NULL,
		[HR_FECH] [datetime] NOT NULL,
	 CONSTRAINT [PK_CG_FND_VERBA_FECH_CONTAB] PRIMARY KEY CLUSTERED 
	(
		[CD_EMP] ASC,
		[DATA_FECHAMENTO] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
	) ON [PRIMARY] 
END
GO
IF (OBJECT_ID('FK_CG_FND_VERBA_FECH_CONTAB_GLB_USU')) IS NULL
BEGIN
	ALTER TABLE [dbo].[CG_FND_VERBA_FECH_CONTAB]  WITH CHECK ADD  CONSTRAINT [FK_CG_FND_VERBA_FECH_CONTAB_GLB_USU] FOREIGN KEY([CD_USU])
	REFERENCES [dbo].[GLB_USU] ([CD_USU])
	ALTER TABLE [dbo].[CG_FND_VERBA_FECH_CONTAB] CHECK CONSTRAINT [FK_CG_FND_VERBA_FECH_CONTAB_GLB_USU]
END