IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EST_PROD_CPL_DEMANDA_PROC]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[EST_PROD_CPL_DEMANDA_PROC](
	[CD_CTR] [int] IDENTITY(1,1) NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[DT_CAD_REGISTRO] [datetime] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[TP_DEMANDA] [int] NOT NULL,
	[DT_PROC] [datetime] NOT NULL,
	[STS_PROC] [int] NOT NULL,
	[ORIGEM_DEMANDA] [int] NOT NULL,
 CONSTRAINT [PK_EST_PROD_CPL_DEMANDA_PROC] 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_CPL_DEMANDA_PROC] ADD  CONSTRAINT [DF_EST_PROD_CPL_DEMANDA_PROC_DT_CAD_REGISTRO]  DEFAULT (getdate()) FOR [DT_CAD_REGISTRO]

ALTER TABLE [dbo].[EST_PROD_CPL_DEMANDA_PROC] ADD  CONSTRAINT [DF_EST_PROD_CPL_DEMANDA_PROC_CD_USU]  DEFAULT ((0)) FOR [CD_USU]

ALTER TABLE [dbo].[EST_PROD_CPL_DEMANDA_PROC] ADD  CONSTRAINT [DF_EST_PROD_CPL_DEMANDA_PROC_TP_DEMANDA]  DEFAULT ((0)) FOR [TP_DEMANDA]

ALTER TABLE [dbo].[EST_PROD_CPL_DEMANDA_PROC] ADD  CONSTRAINT [DF_EST_PROD_CPL_DEMANDA_PROC_STS_PROC]  DEFAULT ((0)) FOR [STS_PROC]

ALTER TABLE [dbo].[EST_PROD_CPL_DEMANDA_PROC] ADD  CONSTRAINT [DF_EST_PROD_CPL_DEMANDA_PROC_ORIGEM_DEMANDA]  DEFAULT ((0)) FOR [ORIGEM_DEMANDA]
END

