在SQL Server 2000中创建视图时出错

时间:2010-08-28 10:13:31

标签: sql sql-server

我正在尝试在SQL Server 2000中创建一个视图

CREATE VIEW [dbo].[AC_VW0901]
AS
SELECT 
CASE T2.ItmsGrpCod  
    WHEN 102 THEN T2.ItmsGrpCod
    WHEN 103 THEN T2.ItmsGrpCod
    WHEN 107 THEN T2.ItmsGrpCod
    WHEN 108 THEN T2.ItmsGrpCod
    ELSE 100 
    END AS ItmsGrpCod, 
CASE
    WHEN Month(T0.TaxDate) >=4 AND Month(T0.TaxDate) <= 12 THEN Month(T0.TaxDate) - 3
    WHEN Month(T0.TaxDate) >=1 AND Month(T0.TaxDate) <= 3  THEN Month(T0.TaxDate) + 9
    END As MonthNum,    
CASE
    WHEN Month(T0.TaxDate) >=4 AND Month(T0.TaxDate) <= 12 THEN Year(T0.TaxDate)
    WHEN Month(T0.TaxDate) >=1 AND Month(T0.TaxDate) <= 3  THEN Year(T0.TaxDate) - 1
    END As YearNum, 
T1.Quantity, T1.LineTotal, T4.U_Username, Month(T0.TaxDate) As [Month], Year(T0.TaxDate) As [Year], T0.TaxDate
FROM OINV T0
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
INNER JOIN OSLP T4 ON T3.SlpCode = T4.SlpCode

这会引发错误,如下所示

  

Msg 208,Level 16,State 1,Server   N4IDEL130007,程序AC_VW0901,   第26行无效的对象名称'OSLP'。

表OSLP非常多。我可以使用另一个视图,对它执行选择查询。 可能是什么原因?

此致 Rahul Jain

1 个答案:

答案 0 :(得分:1)

抱歉,使用像Abc.dbo.OSLP这样的全名来解决问题 感谢。