[dba-SQLServer] Invalid Object Name in Function

David Emerson newsgrps at dalyn.co.nz
Tue Mar 6 17:18:28 CST 2012


For those who are interested, I found the solution:

Edit -> IntelliSense -> Refresh Local Cache

Regards
David


At 5/03/2012, Mark Breen wrote:
>Hi David,
>
>I have had to be careful in the past with the names I applied to the
>function and where I created it.
>
>Can you check if it is stored in your db, in the functions section and not
>in the master db?
>
>can you try specifying full path to rule that our
>[dbname].[dbowner].[functionname]
>
>To eliminate the nested sproc that is called, you can try to execute this
>
>ALTER FUNCTION [dbo].[fn_MobilFuelGetNextSEQN]           --    <- Error
>Invalid object name
>     ( )
>RETURNS INT
>AS
>     BEGIN
>
>         DECLARE @Result INT ,
>             @NewSeqn INT
>
>         BEGIN
>             SET @Result = 1
>             SET @NewSeqn = 1
>         END
>
>
>         RETURN @NewSeqn
>
>     END
>
>Sorry I cannot suggest anything else.
>
>Mark
>
>
>On 5 March 2012 00:08, David Emerson <newsgrps at dalyn.co.nz> wrote:
>
> > Team,
> >
> > I Have SQL2008 R2.
> >
> > The following function which is saved in the SQL database has the function
> > name underlined in red with the error Invalid Object name.  Does anyone
> > know what the problem might be?
> >
> > It seems to be saved in the database under Scalar-valued functions but I
> > can't get rid of the error.
> >
> > USE [iMIS10_MP]
> > GO
> > /****** Object:  UserDefinedFunction [dbo].[fn_**MobilFuelGetNextSEQN]
> >  Script Date: 03/05/2012 13:01:01 ******/
> > SET ANSI_NULLS ON
> > GO
> > SET QUOTED_IDENTIFIER ON
> > GO
> > -- ==============================**===============
> > -- Author:              David Emerson, Dalyn Software
> > -- Created:             5/3/2012
> > -- ==============================**===============
> > ALTER FUNCTION [dbo].[fn_**MobilFuelGetNextSEQN]               <- Error
> > Invalid object name
> > (
> > )
> > RETURNS int
> > AS
> > BEGIN
> >
> >        DECLARE @Result int, @NewSeqn int
> >
> >        EXEC @Result=dbo.sp_iboGetCounter 'Activity',1, at NewSeqn output
> >
> >        RETURN @NewSeqn
> >
> > END
> >
> > Regards
> >
> > David Emerson
> > Dalyn Software Ltd
> > Wellington, New Zealand ______________________________**_________________


More information about the dba-SQLServer mailing list