Creating global procs

  • This should be easy but I can't get it to work. I'm creating a customized version of sp_spaceused. I want to be able to run it against any database on my server. I created it in master under dbo but I can't run it from anywhere but master. Can I make this global somehow?

    Darren


    Darren

  • Create the procedure with prefix 'sp_'. For example, sp_new_spaceused.

  • OK, I got that working but I now have another issue. The new proc can run from any database but returns results only from the master database. Like this statement in the proc returns master db info: Its looking at sysfiles in master not my database.

    select sum(convert(dec(15,2),size))

    from dbo.sysfiles

    where (status & 64 = 0)

    Darren


    Darren

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

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