Vistas SQL ASOFT

Para poder usar las tablas de A3ERP desde Access con ODBC es necesario crear unas vistas, dado que las tablas de A3ERP tienen mas de 10 indices y esto no lo puede manejar Access.

Este es el script para crear las vistas

Abra el SQL management studio

Vaya a la base de datos que interese conectar

Pulse el botón Nueva consulta

Pegue este script de creación de vistas

Y ejecutelo

CREATE VIEW [dbo]. [ASOFT_ARTICULO] AS SELECT * FROM ARTICULO
GO

CREATE VIEW [dbo]. [ASOFT_GRUPOARTICULOS] AS SELECT * FROM __GRUPOARTICULOS
GO

CREATE VIEW [dbo]. [ASOFT_CLIENTES] AS SELECT * FROM CLIENTES
GO

CREATE VIEW [dbo].[ASOFT_CLIENTES_CONTACTOS]
AS
SELECT        Cl.CODCLI, Cl.NOMCLI, Cl.IDORG, C.NOMBRE AS NombreContacto, C.TELEFONO1 AS ContactoTel1, C.TELEFONO2 AS ContactoTel2, C.FAX AS ContactoFax, C.EMAIL AS ContactoEmail, C.CARGO AS contactocargo,
                         dbo.__CARGOS.CODIGO AS codigocargo, dbo.__CARGOS.DESCRIPCION
FROM            dbo.CLIENTES AS Cl LEFT OUTER JOIN
                         dbo.CONTACTOS AS C ON Cl.IDORG = LTRIM(RTRIM(C.CODIGO)) AND C.TABLA = ‘ORG’ LEFT OUTER JOIN
                         dbo.__CARGOS ON dbo.__CARGOS.ID = C.IDCARGO
WHERE        (C.NOMBRE <> ”)
GO

CREATE VIEW [dbo]. [ASOFT_PROVEED] AS SELECT * FROM PROVEED
GO

CREATE VIEW [dbo]. [ASOFT_CABEALBC] AS SELECT * FROM CABEALBC
GO
CREATE VIEW [dbo]. [ASOFT_CABEALBV] AS SELECT * FROM CABEALBV
GO
CREATE VIEW [dbo]. [ASOFT_CABEDEPC] AS SELECT * FROM __CABEDEPC
GO
CREATE VIEW [dbo]. [ASOFT_CABEDEPV] AS SELECT * FROM __CABEDEPV
GO
CREATE VIEW [dbo]. [ASOFT_CABEFACC] AS SELECT * FROM CABEFACC
GO
CREATE VIEW [dbo]. [ASOFT_CABEFACV] AS SELECT * FROM CABEFACV
GO
CREATE VIEW [dbo]. [ASOFT_CABEOFEC] AS SELECT * FROM CABEOFEC
GO
CREATE VIEW [dbo]. [ASOFT_CABEOFEV] AS SELECT * FROM CABEOFEV
GO
CREATE VIEW [dbo]. [ASOFT_CABEPEDC] AS SELECT * FROM CABEPEDC
GO
CREATE VIEW [dbo]. [ASOFT_CABEPEDV] AS SELECT * FROM CABEPEDV
GO

CREATE VIEW [dbo]. [ASOFT_LINEALBA] AS SELECT * FROM LINEALBA
GO
CREATE VIEW [dbo]. [ASOFT_LINEDEPO] AS SELECT * FROM __LINEDEPO
GO
CREATE VIEW [dbo]. [ASOFT_LINEFACT] AS SELECT * FROM LINEFACT
GO
CREATE VIEW [dbo]. [ASOFT_LINEOFER] AS SELECT * FROM LINEOFER
GO
CREATE VIEW [dbo]. [ASOFT_LINEPEDI] AS SELECT * FROM LINEPEDI
GO

CREATE VIEW [dbo]. [ASOFT_CARTERA] AS SELECT * FROM CARTERA
GO

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.