Missing usp_databases.sql file

  • Hi,

    I am not sure if this is the right place for this but I guess this is general question so it might fit here.

    I read an article here at SQLServer Central regarding sizing for databases. At the bottom of the article, there is a link to a SQL script but the link is dead. Does anyone have that script or know of where I can find it? File name of the script is: usp_databases.sql

    thank you.

    (http://www.sqlservercentral.com/columnists/bknight/sizingadatabase.asp)

  • Fixed!

  • Thank you

  • hI There,

    Could you let me know where i can find the usp_database sript or what you did you monitor db growth. since you now have it fixed.

    my email is vivcollin@hotmail.com

  • hello Admin,

    the file/link Usp_databases is current broken.

    sincerely lars

  • Yah it's missing again 🙁

  • If it isn't fixed soon, you can find it here. Hope it helps

    http://www.sql.ru/subscribe/061.shtml

    or

    /* Procedure for 8.0 server */

    create proc usp_databases

    as

    set nocount on

    declare @name sysname

    declare @sql nvarchar(600)

    /* Use temporary table to sum up database size w/o using group by */

    create table #databases (

    DATABASE_NAME sysname NOT NULL,

    size int NOT NULL)

    declare c1 cursor for

    select name from master.dbo.sysdatabases

    where has_dbaccess(name) = 1 -- Only look at databases to which we have access

    open c1

    fetch c1 into @name

    while @@fetch_status >= 0

    begin

    select @sql = 'insert into #databases

    select N'''+ @name + ''', sum(size) from '

    + QuoteName(@name) + '.dbo.sysfiles'

    /* Insert row for each database */

    execute (@SQL)

    fetch c1 into @name

    end

    deallocate c1

    select

    DATABASE_NAME,

    DATABASE_SIZE = size*8,/* Convert from 8192 byte pages to K */

    RUN_DT=GETDATE()

    from #databases

    order by 1

    GO

Viewing 7 posts - 1 through 6 (of 6 total)

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