
/*------ ATD 326496 ------*/
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'PAGAMENTOVENDA')
Begin
	create table PagamentoVenda(
				ID INT IDENTITY NOT NULL,
				NumOrd INT NOT NULL, 
				Valor NUMERIC(15,2) NOT NULL,
				rTipoDoc INT NOT NULL, 
				rCliente INT NOT NULL,
				CONSTRAINT PK_PAGAMENTOVENDA PRIMARY KEY (ID))
	create index PAGAMENTOVENDA_IDX1 on PAGAMENTOVENDA(NumOrd)
End
GO
IF EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'RCLIENTE' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='PAGAMENTOVENDA'))
exec sp_bindefault 'UW_ZeroDefault','PAGAMENTOVENDA.RCLIENTE'
GO