IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GLB_MOV_OP_PRE_FATURA]')) 
	BEGIN 
		RETURN;
	END
ELSE
BEGIN
CREATE TABLE [dbo].[GLB_MOV_OP_PRE_FATURA](
	[CD_MOV_PRE_FATURA] [int] NOT NULL,
	[DS_MOV_PRE_FATURA] [varchar](100) NOT NULL,
	[CD_MOV_OP] [int] NOT NULL,
	[CTR_LOTE] [int] NOT NULL,
	[CD_USU] [int] NOT NULL,
	[DT_CAD] [datetime] NOT NULL,
	[DT_ULT_ALT] [datetime] NULL,
 CONSTRAINT [PK_GLB_MOV_OP_PRE_FATURA] PRIMARY KEY CLUSTERED 
(
	[CD_MOV_PRE_FATURA] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [IX_GLB_MOV_OP_PRE_FATURA] UNIQUE NONCLUSTERED 
(
	[DS_MOV_PRE_FATURA] 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_MOV_OP_PRE_FATURA] ADD  CONSTRAINT [DF_GLB_MOV_OP_PRE_FATURA_CD_MOV_PRE_FATURA]  DEFAULT ((0)) FOR [CD_MOV_PRE_FATURA]

ALTER TABLE [dbo].[GLB_MOV_OP_PRE_FATURA] ADD  CONSTRAINT [DF_GLB_MOV_OP_PRE_FATURA_DS_MOV_PRE_FATURA]  DEFAULT ('') FOR [DS_MOV_PRE_FATURA]

ALTER TABLE [dbo].[GLB_MOV_OP_PRE_FATURA] ADD  CONSTRAINT [DF_GLB_MOV_OP_PRE_FATURA_CD_MOV_OP]  DEFAULT ((0)) FOR [CD_MOV_OP]

ALTER TABLE [dbo].[GLB_MOV_OP_PRE_FATURA] ADD  CONSTRAINT [DF_GLB_MOV_OP_PRE_FATURA_CTR_LOTE]  DEFAULT ((0)) FOR [CTR_LOTE]

ALTER TABLE [dbo].[GLB_MOV_OP_PRE_FATURA] ADD  CONSTRAINT [DF_GLB_MOV_OP_PRE_FATURA_CD_USU]  DEFAULT ((0)) FOR [CD_USU]
END

