Strange behaviour.....

  • USE MASTER

    GO

    IF OBJECT_ID ('SP_PH_WHO2') IS NOT NULL DROP PROC SP_PH_WHO2

    GO

    CREATE PROC SP_PH_WHO2 as

    IF OBJECT_ID ('PH_WHO2_TMP3') IS NOT NULL DROP TABLE PH_WHO2_TMP3

    CREATE TABLE PH_WHO2_TMP3

    (

    SPID VARCHAR(100),

    EVENTTYPE VARCHAR(100),

    PARAMETERS VARCHAR(100),

    EVENTINFO VARCHAR(4000)

    )

    IF OBJECT_ID ('PH_WHO2_TMP3') IS NOT NULL select * from PH_WHO2_TMP3

    when I run this provedure from any other database except master it gives error....table not exists even I am firing query only if table exists.....

    Somehow when I put a search it looks in master database not in the current database...

    Any ideas why it's happening?????

    Prakash

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA

  • Try marking the stored procedure as a system object:

    sp_MS_marksystemobject 'SP_PH_WHO2'

    and see if it works properly after that.

    Matthew Burr

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply