  
/****** Object:  Table [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG]    Script Date: 03/12/2014 14:59:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG]') AND type in (N'U'))
	begin
		return;
	end
else
	begin
	
		/****** Object:  Table [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG]    Script Date: 03/12/2014 14:59:11 ******/
		SET ANSI_NULLS ON
		SET QUOTED_IDENTIFIER ON

		CREATE TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG](
			[CD_EMP] [int] NOT NULL,
			[CD_CTR_DEPO] [int] NOT NULL,
			[CD_ARV_MERC_LINHA] [int] NOT NULL,
			[TP_PRECO] [int] NOT NULL,
			[PERC_ST] [money] NULL,
			[PERC_SEM_ST] [money] NULL,
			[TIPO] [int] NOT NULL,
			[CD_USU] [int] NULL,
			[DT_CAD] [datetime] NULL,
			[DT_ULT_ALT] [datetime] NULL,
		 CONSTRAINT [PK_GLB_CONFIG_PRECO_OPERADOR_LOG] PRIMARY KEY CLUSTERED 
		(
			[CD_EMP] ASC,
			[CD_CTR_DEPO] ASC, 
			[CD_ARV_MERC_LINHA] 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].[GLB_CONFIG_PRECO_OPERADOR_LOG]  WITH CHECK ADD  CONSTRAINT [FK_GLB_CONFIG_PRECO_OPERADOR_LOG_EST_ARV_MERC_LINHA] FOREIGN KEY([CD_ARV_MERC_LINHA], [CD_EMP])
		REFERENCES [dbo].[EST_ARV_MERC_LINHA] ([CD_ARV_MERC_LINHA], [CD_EMP])
		ALTER TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG] CHECK CONSTRAINT [FK_GLB_CONFIG_PRECO_OPERADOR_LOG_EST_ARV_MERC_LINHA]
		ALTER TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG] ADD  CONSTRAINT [DF_GLB_CONFIG_PRECO_OPERADOR_LOG_TP_PRECO]  DEFAULT ((0)) FOR [TP_PRECO]
		ALTER TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG] ADD  CONSTRAINT [DF_GLB_CONFIG_PRECO_OPERADOR_LOG_PERC_ST]  DEFAULT ((0)) FOR [PERC_ST]
		ALTER TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG] ADD  CONSTRAINT [DF_GLB_CONFIG_PRECO_OPERADOR_LOG_PERC_SEM_ST]  DEFAULT ((0)) FOR [PERC_SEM_ST]
		ALTER TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG] ADD  CONSTRAINT [DF_GLB_CONFIG_PRECO_OPERADOR_LOG_TIPO]  DEFAULT ((0)) FOR [TIPO]
		ALTER TABLE [dbo].[GLB_CONFIG_PRECO_OPERADOR_LOG] ADD  CONSTRAINT [DF_GLB_CONFIG_PRECO_OPERADOR_LOG_CD_USU]  DEFAULT ((0)) FOR [CD_USU]
	end