• Jeff Moden (4/14/2014)


    It sounds like either you're in the wrong database when you're looking for things or the things are in the wrong database. They didn't get copied to the master database by mistake, did they?

    I can't see how they would have copied to master, how would I find these?

    I've just run this script, which fails as expected.

    USE Live_DB

    GO

    select name from sys.objects where name like '%HighCharacter%'

    select object_id('HighCharacter')

    GO

    CREATE FUNCTION [dbo].[HighCharacter] (

    ) RETURNS HighLowCharType

    AS

    BEGIN

    RETURN REPLICATE(NCHAR(65392), 4000)

    END;

    GO

    drop function [HighCharacter];

    GO

    print ''

    USE Pilot_DB

    GO

    print 'select on pilot'

    select name from sys.objects where name like '%HighCharacter%'

    select object_id('HighCharacter')

    GO

    USE Master

    GO

    print 'select on master'

    select name from sys.objects where name like '%HighCharacter%'

    select object_id('HighCharacter')

    GO

    Which outputs the below - Note there is no exact match on name in first select from broken DB:

    name

    --------------------------------------------------------------------------------------------------------------------------------

    BAC_HighCharacter

    EXTGEN_GenerateBAC_HighCharacter

    GenerateHighCharacter

    TY_HighCharacter

    (4 row(s) affected)

    -----------

    NULL

    (1 row(s) affected)

    Msg 2714, Level 16, State 3, Procedure HighCharacter, Line 5

    There is already an object named 'HighCharacter' in the database.

    Msg 3701, Level 11, State 5, Line 1

    Cannot drop the function 'HighCharacter', because it does not exist or you do not have permission.

    select on pilot

    name

    --------------------------------------------------------------------------------------------------------------------------------

    GenerateHighCharacter

    HighCharacter

    (2 row(s) affected)

    -----------

    726579414

    (1 row(s) affected)

    select on master

    name

    --------------------------------------------------------------------------------------------------------------------------------

    (0 row(s) affected)

    -----------

    NULL

    (1 row(s) affected)