IF  NOT EXISTS (SELECT * FROM sys.objects 
					WHERE object_id = OBJECT_ID(N'[dbo].[ADM_ERRO_GLB_USU]') 
					AND type in (N'U')) 
begin
CREATE TABLE [dbo].[ADM_ERRO_GLB_USU](
	[CODIGO] [int] NOT NULL,
	[CD_USU] [int] NOT NULL,
 CONSTRAINT [PK_ADM_ERRO_GLB_USU] PRIMARY KEY CLUSTERED 
(
	[CODIGO] ASC,
	[CD_USU] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [dbo].[ADM_ERRO_GLB_USU]  WITH CHECK ADD  CONSTRAINT [FK_ADM_ERRO_GLB_USU_ADM_ERRO] FOREIGN KEY([CODIGO])
REFERENCES [dbo].[ADM_ERRO] ([CODIGO])

ALTER TABLE [dbo].[ADM_ERRO_GLB_USU] CHECK CONSTRAINT [FK_ADM_ERRO_GLB_USU_ADM_ERRO]

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

ALTER TABLE [dbo].[ADM_ERRO_GLB_USU] CHECK CONSTRAINT [FK_ADM_ERRO_GLB_USU_GLB_USU]
end

