IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES
			 WHERE TABLE_NAME='EST_MOV_MOTOQ_PENDENTE')
begin
CREATE TABLE [dbo].[EST_MOV_MOTOQ_PENDENTE](
	[CD_MOV] [int] NOT NULL,
	[DT_CAD] [datetime] NULL,
 CONSTRAINT [PK_EST_MOV_MOTOQ_PENDENTE_1] PRIMARY KEY CLUSTERED 
(
	[CD_MOV] 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_MOV_MOTOQ_PENDENTE] ADD  CONSTRAINT [DF_EST_MOV_MOTOQ_PENDENTE_DT_CAD]  DEFAULT (getdate()) FOR [DT_CAD]

ALTER TABLE [dbo].[EST_MOV_MOTOQ_PENDENTE]  WITH CHECK ADD  CONSTRAINT [FK_EST_MOV_MOTOQ_PENDENTE_EST_MOV_MOTOQ] FOREIGN KEY([CD_MOV])
REFERENCES [dbo].[EST_MOV_MOTOQ] ([CD_MOV])
ON UPDATE CASCADE
ON DELETE CASCADE

ALTER TABLE [dbo].[EST_MOV_MOTOQ_PENDENTE] CHECK CONSTRAINT [FK_EST_MOV_MOTOQ_PENDENTE_EST_MOV_MOTOQ]
END

