解决方案: |
执行以下脚本,生成视图:
(1)if exists (select * from sysobjects where id = object_id(N'[dbo].[justinlist]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[justinlist]
GO
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON
GO
create view justinlist as SELECT JustInQ.cJVCode, JustInQ.cVouchType, JustInQ.cWhCode, JustInQ.dJVDate,JustInQ.cUnitCode, JustInQ.cDepCode, JustInQ.cPersonCode, JustInQ.cRdCode,JustInQ.cJVMemo, JustInQ.cJVDefine1, JustInQ.cJVDefine2, JustInQ.cJVDefine3, JustInQ.cAccounter, JustInQ.cMaker, JustInQ.cWhName, JustInQ.cVenAbbName,JustInQ.cDepName, JustInQ.cPersonName, JustInQ.cRdName, JustInQ.bRdFlag,JustInQ.cHandler, JustInQ.cPersonName_1, justinsq.cJVCode AS cJVCode_1,justinsq.cInvCode, justinsq.AutoID, justinsq.cInvName, justinsq.cInvStd, justinsq.cCorCode, justinsq.iJVPrice, justinsq.cFree1, justinsq.cFree2, justinsq.CorID,JustInQ.cDefine1, JustInQ.cDefine2, JustInQ.cDefine3, JustInQ.cDefine4,JustInQ.cDefine5, JustInQ.cDefine6, JustInQ.cDefine7, JustInQ.cDefine8,JustInQ.cDefine9, JustInQ.cDefine10,JustInsQ.cDefine22, JustInsQ.cDefine23, JustInsQ.cDefine24,justinsq.cdefine25 , justinsq.cdefine26, justinsq.cdefine27 FROM JustInQ LEFT OUTER JOIN justinsq ON JustInQ.cJVCode = justinsq.cJVCode
GO
SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON
GO
(2)if exists (select * from sysobjects where id = object_id(N'[dbo].[JustInQ]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[JustInQ]
GO
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON
GO
Create View JustInQ AS
SELECT JustInVouch.cJVCode, JustInVouch.cVouchType, JustInVouch.cWhCode,
JustInVouch.dJVDate, JustInVouch.cUnitCode, JustInVouch.cDepCode,
JustInVouch.cPersonCode, JustInVouch.cRdCode, JustInVouch.cJVMemo,
JustInVouch.cJVDefine1, JustInVouch.cJVDefine2, JustInVouch.cJVDefine3,
JustInVouch.cAccounter, JustInVouch.cMaker, Warehouse.cWhName,
Vendor.cVenAbbName, Department.cDepName, Person.cPersonName,
Rd_Style.cRdName, JustInVouch.bRdFlag, JustInVouch.cHandler,
Person1.cPersonName AS cPersonName_1, JustInVouch.cDefine1,
JustInVouch.cDefine2, JustInVouch.cDefine3, JustInVouch.cDefine4,
JustInVouch.cDefine5, JustInVouch.cDefine6, JustInVouch.cDefine7,
JustInVouch.cDefine8, JustInVouch.cDefine9, JustInVouch.cDefine10
FROM JustInVouch LEFT OUTER JOIN
Department ON JustInVouch.cDepCode = Department.cDepCode LEFT OUTER JOIN
GL_bdigest ON JustInVouch.cJVMemo = GL_bdigest.cid LEFT OUTER JOIN
Person ON JustInVouch.cPersonCode = Person.cPersonCode LEFT OUTER JOIN
Person Person1 ON
JustInVouch.cHandler = Person1.cPersonCode LEFT OUTER JOIN
Rd_Style ON JustInVouch.cRdCode = Rd_Style.cRdCode LEFT OUTER JOIN
Vendor ON JustInVouch.cUnitCode = Vendor.cVenCode LEFT OUTER JOIN
Warehouse ON JustInVouch.cWhCode = Warehouse.cWhCode
WHERE (JustInVouch.cVouchType = '20')
GO
SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON
GO
(3)if exists (select * from sysobjects where id = object_id(N'[dbo].[justinsq]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[justinsq]
GO
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON
GO
create view justinsq as SELECT JustInVouchs.cJVCode, JustInVouchs.cInvCode, JustInVouchs.AutoID,JustInVouchs.cDefine22, JustInVouchs.cDefine23, JustInVouchs.cDefine24,JustInVouchs.cDefine25, JustInVouchs.cDefine26, JustInVouchs.cDefine27,Inventory.cInvName, Inventory.cInvStd, JustInVouchs.cCorCode,JustInVouchs.iJVPrice, JustInVouchs.cFree1, JustInVouchs.cFree2,JustInVouchs.CorID FROM JustInVouchs LEFT OUTER JOIN Inventory ON JustInVouchs.cInvCode = Inventory.cInvCode
GO
SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON
GO
(4)if exists (select * from sysobjects where id = object_id(N'[dbo].[justoutlist]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[justoutlist]
GO
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON
GO
create view justoutlist as SELECT JustOutQ.cJVCode, JustOutQ.cVouchType, JustOutQ.cWhCode, JustOutQ.dJVDate,JustOutQ.cUnitCode, JustOutQ.cDepCode, JustOutQ.cPersonCode, JustOutQ.cRdCode,JustOutQ.cJVMemo, JustOutQ.cJVDefine1, JustOutQ.cJVDefine2, JustOutQ.cJVDefine3,JustOutQ.cAccounter, JustOutQ.cMaker, JustOutQ.cWhName, JustOutQ.cDepName,JustOutQ.cPersonName, JustOutQ.cRdName, JustOutQ.bRdFlag, JustOutQ.cHandler,JustOutQ.cPersonName_1, JustOutQ.cCusAbbName,justoutsq.cJVCode AS cJVCode_1, justoutsq.cInvCode, justoutsq.AutoID,justoutsq.cInvName, justoutsq.cInvStd, justoutsq.iJVPrice, justoutsq.cFree1,justoutsq.cFree2, justoutsq.cObjCode, justoutsq.cName, JustOutQ.cDefine1,JustOutQ.cDefine2, JustOutQ.cDefine3, JustOutQ.cDefine4, JustOutQ.cDefine5,JustOutQ.cDefine6, JustOutQ.cDefine7, JustOutQ.cDefine8, JustOutQ.cDefine9,JustOutQ.cDefine10 , justoutsq.cdefine22, justoutsq.cdefine23, justoutsq.cdefine24, justoutsq.cdefine25, justoutsq.cdefine26, justoutsq.cdefine27 FROM JustOutQ LEFT OUTER JOIN justoutsq ON JustOutQ.cJVCode = justoutsq.cJVCode
GO
SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON
GO
(5)if exists (select * from sysobjects where id = object_id(N'[dbo].[JustOutQ]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[JustOutQ]
GO
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON
GO
Create View JustOutQ AS
SELECT JustInVouch.cJVCode, JustInVouch.cVouchType, JustInVouch.cWhCode,
JustInVouch.dJVDate, JustInVouch.cUnitCode, JustInVouch.cDepCode,
JustInVouch.cPersonCode, JustInVouch.cRdCode, JustInVouch.cJVMemo,
JustInVouch.cJVDefine1, JustInVouch.cJVDefine2, JustInVouch.cJVDefine3,
JustInVouch.cAccounter, JustInVouch.cMaker, Warehouse.cWhName,
Department.cDepName, Person.cPersonName, Rd_Style.cRdName,
JustInVouch.bRdFlag, JustInVouch.cHandler,
Person1.cPersonName AS cPersonName_1, Customer.cCusAbbName, JustInVouch.cDefine1,
JustInVouch.cDefine2, JustInVouch.cDefine3, JustInVouch.cDefine4, JustInVouch.cDefine5,
JustInVouch.cDefine6, JustInVouch.cDefine7, JustInVouch.cDefine8, JustInVouch.cDefine9,
JustInVouch.cDefine10
FROM JustInVouch LEFT OUTER JOIN
Customer ON JustInVouch.cUnitCode = Customer.cCusCode LEFT OUTER JOIN
Department ON JustInVouch.cDepCode = Department.cDepCode LEFT OUTER JOIN
GL_bdigest ON JustInVouch.cJVMemo = GL_bdigest.cid LEFT OUTER JOIN
Person ON JustInVouch.cPersonCode = Person.cPersonCode LEFT OUTER JOIN
Person Person1 ON
JustInVouch.cHandler = Person1.cPersonCode LEFT OUTER JOIN
Rd_Style ON JustInVouch.cRdCode = Rd_Style.cRdCode LEFT OUTER JOIN
Warehouse ON JustInVouch.cWhCode = Warehouse.cWhCode
WHERE (JustInVouch.cVouchType = '21')
GO
SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON
GO
(6)if exists (select * from sysobjects where id = object_id(N'[dbo].[justoutsq]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[justoutsq]
GO
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON
GO
create view justoutsq as SELECT JustInVouchs.cJVCode, JustInVouchs.cInvCode, JustInVouchs.AutoID,JustInVouchs.cDefine22, JustInVouchs.cDefine23, JustInVouchs.cDefine24,JustInVouchs.cDefine25, JustInVouchs.cDefine26, JustInVouchs.cDefine27,Inventory.cInvName, Inventory.cInvStd, JustInVouchs.iJVPrice, JustInVouchs.cFree1,JustInVouchs.cFree2 , JustInVouchs.cObjCode, CostObj.cName FROM JustInVouchs LEFT JOIN CostObj ON JustInVouchs.cObjCode = CostObj.cCode LEFT JOIN Inventory ON JustInVouchs.cInvCode = Inventory.cInvCode
GO
SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON
GO
|