[dba-SQLServer] Invalid Object Name in Function

David Emerson newsgrps at dalyn.co.nz
Mon Mar 5 15:27:58 CST 2012


Thanks Mark.

When I went into the database this morning suddenly it was being 
recognised.  Even though I refreshed the database yesterday it didn't 
recognise it.  Maybe I should have tried closing and opening the 
database yesterday.

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 ______________________________**_________________
> > dba-SQLServer mailing list
> > dba-SQLServer@**databaseadvisors.com <dba-SQLServer at databaseadvisors.com>
> > 
> http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver<http://databaseadvisors.com/mailman/listinfo/dba-sqlserver>
> > http://www.databaseadvisors.**com <http://www.databaseadvisors.com>
> >
> >
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com



More information about the dba-SQLServer mailing list