Errors after importing schema.

I'm geting the following error after importing, the view works but can't find a reference to the function which has aslo imported correctly. The function is question has red ! icon against it. In most of the object have red ! icons.

Error 1 Cannot find either column "dbo" or the user-defined function or aggregate "dbo.udfRemoveNullValues", or the name is ambiguous. D:\VSProjects06\Database\Trunk\EW Databases\EW Application Database\EW Application Database\Schema Objects\Views\VIEW_ERP_INTEGRATION_CUSTOMER_DETAILS.view.sql 5 1 EW Application Database

Thanks

[601 byte] By [Tobi] at [2008-2-6]
# 1

Can you post the text of the UDF here? If not can you email it to me?

The error would indicate that you have a select without a schema and for some reason we think the table or view reference is ambiguous (i.e. could point to more than one table possibly).

RichardWaymire-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 2

Hi

I have the same errors after importing schema. There is one of them:

Error 1 Cannot find either column "dbo" or the user-defined function or aggregate "dbo.GetEventConfirmedBookings", or the name is ambiguous. D:\Projects\Speedy\Database\Database\Schema Objects\Views\vPostTrainingToComplete.view.sql 6 1 Database

View:

CREATE VIEW vPostTrainingToComplete
AS
SELECT
e.ID, c.Title, e.Type, e.PostTrainingCompleted, e.CourseID, e.StartDate, e.OwnerUserID, e.MaxDelegates,
CASE e.Type WHEN 'E' THEN 'External' WHEN 'I' THEN 'Internal' END AS TypeLabel,
dbo.GetEventConfirmedBookings(e.ID) AS BookedPlaces
FROM
Events e
INNER JOIN Courses c ON e.CourseID = c.ID
WHERE
e.CourseID IS NOT NULL
AND e.StartDate <= getDate() AND e.Cancelled=0

Function:

CREATE FUNCTION GetEventConfirmedBookings (@eventId bigint)
RETURNS int
AS
BEGIN
DECLARE @count int
SELECT @count = COUNT(*) FROM Bookings WHERE
BookingStatus = 'CA' AND (CancellingStatus IN ('W', 'CM', 'RM', 'RA') OR CancellingStatus IS NULL)
AND (Type = 'B' OR Type = 'C') AND EventID = @eventId
RETURN @count
END

If you need more info drop me a line.

Ziemowit at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 3

Probably a silly question but are you running the function in the correct database? That is the error message you would receive if you were running that code in "master", for example.

USE AdventureWorks

GO

CREATE FUNCTION dbo.Junk ()

RETURNS INT

AS

BEGIN

RETURN -1

END

GO

USE tempdb

GO

CREATE VIEW MyView

AS

SELECT 1, dbo.Junk() AS JunkData

GO

-- This returns error

Msg 4121, Level 16, State 1, Procedure MyView, Line 3

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Junk", or the name is ambiguous.

/****************************************************

Check out our Sql Server 2005 and 2000 tutorials

****************************************************/

LearnSqlServer.com at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...

Visual Studio Team System

Site Classified