ALTER TABLE Agencias ADD TipoZona VARCHAR(10)
GO
ALTER TABLE Trn_Opedido ADD ZonaFrontera BIT NOT NULL DEFAULT(0)
GO
ALTER TABLE Trn_OComb ADD ZonaFrontera BIT NOT NULL DEFAULT(0)
GO
ALTER TABLE Trn_Guia ADD ZonaFrontera BIT NOT NULL DEFAULT(0)
GO
ALTER TABLE Trn_Facturas ADD ZonaFrontera BIT NOT NULL DEFAULT(0)
GO
ALTER TABLE Trn_DevFcr ADD ZonaFrontera BIT NOT NULL DEFAULT(0)
GO
ALTER TABLE Companias ADD TipoEDS VARCHAR(10) DEFAULT('NINGUNO')
GO
CREATE TABLE ProdImpFron ( 
IdProducto VARCHAR(16) NOT NULL,
IdClase VARCHAR(4) NOT NULL,
Item INT DEFAULT (0) NOT NULL,
IdLocal VARCHAR(8) NOT NULL,
Tarifa DECIMAL(14,4) DEFAULT (0) NOT NULL,
SimbTfa CHAR(1) DEFAULT ('%') NOT NULL,
CdTarifa VARCHAR(4),
RngFecha BIT DEFAULT (0) NOT NULL,
FecInicial SMALLDATETIME,
FecFinal SMALLDATETIME,
LtaPre CHAR(1),
Inactivo BIT DEFAULT (0) NOT NULL,
FecUpdate SMALLDATETIME NOT NULL
 CONSTRAINT PK_ProdImpFron PRIMARY KEY CLUSTERED (IdProducto,IdClase,Item),
 CONSTRAINT CK_ProdImpFronIdClase CHECK ((len([IdClase]) > 0)),
 CONSTRAINT CK_ProdImpFronIdLocal CHECK ((len([IdLocal]) > 0)),
 CONSTRAINT CK_ProdImpFronIdProducto CHECK ((len([IdProducto]) > 0)),
 CONSTRAINT CK_ProdImpFronSimbTfa CHECK ((len([SimbTfa]) > 0)))
GO
ALTER TABLE ProdImpFron ADD 
 CONSTRAINT FK_ProdImpFron_ClaseTar FOREIGN KEY (IdClase) REFERENCES [dbo].[ClaseTar] (IdClase),
 CONSTRAINT FK_ProdImpFron_Localidades FOREIGN KEY (IdLocal) REFERENCES [dbo].[Localidades] (IdLocal),
 CONSTRAINT FK_ProdImpFron_ProdMcias FOREIGN KEY (IdProducto) REFERENCES [dbo].[ProdMcias] (IdProducto)
 CREATE NONCLUSTERED INDEX IX_ProdImpFronIdLocal ON ProdImpFron(IdLocal)

