IF  NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT]') AND type in (N'U'))
begin
CREATE TABLE [dbo].[EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT](
	[CD_CTR_PRE_ENTRADA] [int] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [date] NOT NULL,
	[HORA_CAD] [datetime] NOT NULL,
	[ACAO] [varchar](50) NULL
) ON [PRIMARY]

ALTER TABLE [dbo].[EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT] ADD  CONSTRAINT [DF_EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT_HORA_CAD]  DEFAULT (getdate()) FOR [HORA_CAD]

ALTER TABLE [dbo].[EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT]  WITH CHECK ADD  CONSTRAINT [FK_EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT_GLB_USU] FOREIGN KEY([CD_USU])
REFERENCES [dbo].[GLB_USU] ([CD_USU])

ALTER TABLE [dbo].[EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT] CHECK CONSTRAINT [FK_EST_NF_ENT_PRE_ENTRADA_GLB_USU_AUDIT_GLB_USU]
end

