Home All Groups Group Topic Archive Search About

Stored procedures in master database SQL Server 200/2005



Author
16 Mar 2006 4:49 PM
Mike
Could someone please provide me with reasons why NOT to store user created
stored procedures in the master database?

Thank you.
--
Mike

Author
17 Mar 2006 6:46 AM
Uri Dimant
Mike
use master
go
create proc sp_first
as
select 1

go
create proc spsecond
as
select 2

use test
go
exec sp_first
---1
exec  spsecond
--Server: Msg 2812, Level 16, State 62, Line 1
---Could not find stored procedure 'spsecond'.


sp_  prefix  tells SQL Server to loking for stored procedure first in the
master database.




Show quoteHide quote
"Mike" <M***@discussions.microsoft.com> wrote in message
news:F2476E25-8F2F-4A34-9288-4D0D30C958E8@microsoft.com...
> Could someone please provide me with reasons why NOT to store user created
> stored procedures in the master database?
>
> Thank you.
> --
> Mike
Are all your drivers up to date? click for free checkup

Author
17 Mar 2006 2:20 PM
AndyP
The main issue will be portability. Just remember to script the procs out to
move them between database servers; a backup and restore of master is
probably not what you want to do on dis-similar servers. A stored procedure
beginning in sp_ is first searched for in master, and then the database you
are in. It can be handy.

--
AndyP,
Sr. Database Administrator,
MCDBA 2003


Show quoteHide quote
"Mike" wrote:

> Could someone please provide me with reasons why NOT to store user created
> stored procedures in the master database?
>
> Thank you.
> --
> Mike

Bookmark and Share