• EXECUTE Northwind.dbo.sp_who should have worked and printed Surprise.

    Actually not, it has something to do with the name resolution, but any procedure that starts sp_ is first looked for in master, no matter if it's fully qualified or not. I tried that just now.

    USE

    Northwind

    GO

    CREATE

    PROCEDURE sp_who

    AS

    PRINT 'Surprise'

    GO

    EXEC

    sp_who

    EXEC Northwind.dbo.sp_who

    and in both cases I got the process list back.

    I do recall playing with this some time back, and if the user-created stored proc is owned by someone other than dbo, then it can be executed with a fully qualified name. If it's owed by dbo then the one in master is always run, no matter how qualified the call is.

     

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass