IF OBJECT_ID('PG_CRED_PROC_PENDENCIA') IS NULL
BEGIN
CREATE TABLE [dbo].[PG_CRED_PROC_PENDENCIA](
	[CD_CTR] [int] IDENTITY(1,1) NOT NULL,
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_PG_CRED] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
 CONSTRAINT [PK_PG_CRED_PROC_PENDENCIA] PRIMARY KEY CLUSTERED 
(
	[CD_CTR] 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].[PG_CRED_PROC_PENDENCIA]  WITH CHECK ADD  CONSTRAINT [FK_PG_CRED_PROC_PENDENCIA_PG_CRED] FOREIGN KEY([CD_EMP], [CD_FILIAL], [CD_PG_CRED])
REFERENCES [dbo].[PG_CRED] ([CD_EMP], [CD_FILIAL], [CD_PG_CRED])
ON UPDATE CASCADE
ON DELETE CASCADE

ALTER TABLE [dbo].[PG_CRED_PROC_PENDENCIA] CHECK CONSTRAINT [FK_PG_CRED_PROC_PENDENCIA_PG_CRED]
END

