 

/****** Object:  Table [dbo].[EST_PROD_TBL_DESC]    Script Date: 09/16/2013 14:35:12 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[EST_PED_CP_PARAM](
	[CD_EMP] [int] NOT NULL,
	[CD_PED_CP_PARAM] [int] NOT NULL,
	[DS_PED_CP_PARAM] [varchar](100) NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[DT_ULT_ALT] [datetime] NULL,
	[STS_PED_CP_PARAM] [int] NULL,
	[FLAG_TODAS_FILIAIS] [int] NULL,
	[FLAG_FALTAS_MCP] [int] NULL,
	[FLAG_COMPRA_OL] [int] NULL,
 CONSTRAINT [PK_EST_PED_CP_PARAM] PRIMARY KEY CLUSTERED 
(
	[CD_EMP] ASC,
	[CD_PED_CP_PARAM] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_CP_PARAM_GLB_USU] FOREIGN KEY([CD_USU])
REFERENCES [dbo].[GLB_USU] ([CD_USU])
ON UPDATE CASCADE
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM] CHECK CONSTRAINT [FK_EST_PED_CP_PARAM_GLB_USU]
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM]  WITH CHECK ADD  CONSTRAINT [FK_EST_PED_CP_PARAM_PRC_EMP] FOREIGN KEY([CD_EMP])
REFERENCES [dbo].[PRC_EMP] ([CD_EMP])
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM] CHECK CONSTRAINT [FK_EST_PED_CP_PARAM_PRC_EMP]
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM] ADD  CONSTRAINT [DF_EST_PED_CP_PARAM_STS_PED_CP_PARAM]  DEFAULT ((0)) FOR [STS_PED_CP_PARAM]
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM] ADD  CONSTRAINT [DF_EST_PED_CP_PARAM_FLAG_TODAS_FILIAIS]  DEFAULT ((0)) FOR [FLAG_TODAS_FILIAIS]
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM] ADD  CONSTRAINT [DF_EST_PED_CP_PARAM_FLAG_COMPRA_OL]  DEFAULT ((0)) FOR [FLAG_COMPRA_OL]
GO

ALTER TABLE [dbo].[EST_PED_CP_PARAM] ADD  CONSTRAINT [DF_EST_PED_CP_PARAM_FLAG_FALTAS_MCP]  DEFAULT ((0)) FOR [FLAG_FALTAS_MCP]
GO