IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_PROD_TABLOIDE_FILIAL_DELETADO]')) 
	BEGIN 
		RETURN;
	END
else
begin
CREATE TABLE [dbo].[EST_PROD_TABLOIDE_FILIAL_DELETADO](
	[CD_CTR] [int] IDENTITY(1,1) NOT NULL,
	[CD_EMP] [int] NOT NULL,
	[CD_FILIAL] [int] NOT NULL,
	[CD_TABLOIDE] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[FLAG_PROCESSADO] [int] NOT NULL,
 CONSTRAINT [PK_EST_PROD_TABLOIDE_FILIAL_DELETADO] 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].[EST_PROD_TABLOIDE_FILIAL_DELETADO] ADD  CONSTRAINT [DF_EST_PROD_TABLOIDE_FILIAL_DELETADO_CD_EMP]  DEFAULT ((0)) FOR [CD_EMP]

ALTER TABLE [dbo].[EST_PROD_TABLOIDE_FILIAL_DELETADO] ADD  CONSTRAINT [DF_EST_PROD_TABLOIDE_FILIAL_DELETADO_CD_FILIAL]  DEFAULT ((0)) FOR [CD_FILIAL]

ALTER TABLE [dbo].[EST_PROD_TABLOIDE_FILIAL_DELETADO] ADD  CONSTRAINT [DF_EST_PROD_TABLOIDE_FILIAL_DELETADO_CD_TABLOIDE]  DEFAULT ((0)) FOR [CD_TABLOIDE]

ALTER TABLE [dbo].[EST_PROD_TABLOIDE_FILIAL_DELETADO] ADD  CONSTRAINT [DF_EST_PROD_TABLOIDE_FILIAL_DELETADO_DT_CAD]  DEFAULT (getdate()) FOR [DT_CAD]

ALTER TABLE [dbo].[EST_PROD_TABLOIDE_FILIAL_DELETADO] ADD  CONSTRAINT [DF_EST_PROD_TABLOIDE_FILIAL_DELETADO_FLAG_PROCESSADO]  DEFAULT ((0)) FOR [FLAG_PROCESSADO]
end

