IF OBJECT_ID('PG_FORN_PAINEL_NFE_LIBERADO') IS NULL
BEGIN
CREATE TABLE [dbo].[PG_FORN_PAINEL_NFE_LIBERADO](
	[CD_EMP] [int] NOT NULL,
	[CD_FORN] [int] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[STS_FORN_LIB] [int] NOT NULL,
 CONSTRAINT [PK_PG_FORN_PAINEL_NFE_LIBERADO] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_FORN] 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_FORN_PAINEL_NFE_LIBERADO] ADD  CONSTRAINT [DF_PG_FORN_PAINEL_NFE_LIBERADO_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[PG_FORN_PAINEL_NFE_LIBERADO] ADD  CONSTRAINT [DF_PG_FORN_PAINEL_NFE_LIBERADO_CD_FORN]  DEFAULT ((0)) FOR [CD_FORN]

ALTER TABLE [dbo].[PG_FORN_PAINEL_NFE_LIBERADO] ADD  CONSTRAINT [DF_PG_FORN_PAINEL_NFE_LIBERADO_CD_USU]  DEFAULT ((0)) FOR [CD_USU]

ALTER TABLE [dbo].[PG_FORN_PAINEL_NFE_LIBERADO] ADD  CONSTRAINT [DF_Table_1_STS_FORN]  DEFAULT ((0)) FOR [STS_FORN_LIB]

ALTER TABLE [dbo].[PG_FORN_PAINEL_NFE_LIBERADO]  WITH CHECK ADD  CONSTRAINT [FK_PG_FORN_PAINEL_NFE_LIBERADO_PG_FORN] FOREIGN KEY([CD_EMP], [CD_FORN])
REFERENCES [dbo].[PG_FORN] ([CD_EMP], [CD_FORN])

ALTER TABLE [dbo].[PG_FORN_PAINEL_NFE_LIBERADO] CHECK CONSTRAINT [FK_PG_FORN_PAINEL_NFE_LIBERADO_PG_FORN]
END

