IF OBJECT_ID('PG_FORN_INTEGRACAO_ARQ_PENDENTE') IS NULL	
	BEGIN 

		CREATE TABLE [dbo].[PG_FORN_INTEGRACAO_ARQ_PENDENTE](
			[CD_CTR] [int] IDENTITY(1,1) NOT NULL,
			[CD_EMP] [int] NOT NULL,
			[CD_FORN] [int] NOT NULL,
			[CD_INT] [int] NOT NULL,
			[NM_ARQ_ENVIO] [varchar](100) NULL,
			[NM_ARQ_RETORNO] [varchar](100) NULL,
			[ST_RETORNO] [int] NOT NULL,
			[DT_HR_RETORNO] [datetime] NULL,
			[DT_HR_ENVIO] [datetime] NULL,
		 CONSTRAINT [PK_PG_FORN_INTEGRACAO_ARQ_PENDENTE] 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, FILLFACTOR = 90) ON [PRIMARY]
		) ON [PRIMARY]		

		ALTER TABLE [dbo].[PG_FORN_INTEGRACAO_ARQ_PENDENTE]  WITH CHECK ADD  CONSTRAINT [FK_PG_FORN_INTEGRACAO_ARQ_PENDENTE_PG_FORN_INTEGRACAO] FOREIGN KEY([CD_EMP], [CD_FORN], [CD_INT])
		REFERENCES [dbo].[PG_FORN_INTEGRACAO] ([CD_EMP], [CD_FORN], [CD_INT])
		ON UPDATE CASCADE
		

		ALTER TABLE [dbo].[PG_FORN_INTEGRACAO_ARQ_PENDENTE] CHECK CONSTRAINT [FK_PG_FORN_INTEGRACAO_ARQ_PENDENTE_PG_FORN_INTEGRACAO]
		

		ALTER TABLE [dbo].[PG_FORN_INTEGRACAO_ARQ_PENDENTE] ADD  CONSTRAINT [DF_PG_FORN_INTEGRACAO_ARQ_PENDENTE_ST_RETORNO]  DEFAULT ((0)) FOR [ST_RETORNO]
		

	END
