0

我正在尝试将视图从一个数据库复制到另一个数据库并得到错误:

消息 4121,级别 16,状态 1,过程 vwPAProjects_Summary_New_2 第 2 行
找不到列“dbo”或用户定义的函数或聚合“dbo.GetContractName”,或者名称不明确

我正在复制的视图是:

USE [GRAUD]
GO
/****** Object:  View [dbo].[vwPAProjects_Summary_New_2]    Script Date: 11/07/2012 11:57:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[vwPAProjects_Summary_New_2] AS 
select
 dbo.GetContractName(PAPROJNUMBER) 'CONTRACT',
PACONTNUMBER,
isnull(dbo.GetEmployeeName(PABusMgrID),dbo.GetContractPartner(PACONTNUMBER)) 'Project Manager ID',
case PASTAT
when 1 then 'Open'
else 'Closed'
end 'Status',
case PAProjectType
when 3 then 'Fixed Price'
else 'Time and Materials'
end 'Project Type',
PAProject_Fee_Amount 'Project Fee Amount',
PAFTotalCost 'Forecast Total Cost',
(PAProject_Fee_Amount - PAFTotalCost) 'Forcast Profit',
case
    when PAProject_Fee_Amount = 0 then '0.00%'
    else cast(cast(((PAProject_Fee_Amount - PAFTotalCost)/PAProject_Fee_Amount)*100 as decimal(19,2)) as varchar(21)) + '%'
end 'Forcast %',
PAPostedBillingsN 'Actual Billings',
PAPostedTotalCostN 'Actual Total Cost',
(PAPostedBillingsN - PAPostedTotalCostN) 'Current Actual Profit',
case
    when PAPostedBillingsN = 0 then '0.00%'
    else cast(cast(((PAPostedBillingsN - PAPostedTotalCostN)/PAPostedBillingsN)*100 as decimal(19,2)) as varchar(21)) + '%'
end 'Current %'

from PA01201
where PASTAT = 1

有人可以建议我如何将其复制过来吗?在我复制它之后,它已经在其他数据库上工作了,但是我看不出这次会阻止它的任何差异?

4

1 回答 1

2

首先复制该功能dbo.GetContractName,然后您也应该找到视图副本。

于 2012-11-07T12:14:24.560 回答