growth db

  • hi

    --select * from tbl_database_detail_excel1 --- this is my table

    create procedure database_growth

    as

    begin

    declare @dbname nvarchar(1000)

    declare @db nvarchar(100)

    declare c1 cursor for

    /*select database_name,server_name, database_size, datafie_size, logfile_size, datafile_location, logfile_location

    into #backupinfo

    from tbl_database_detail_excel1 */

    select database_name,server_name, database_size, datafie_size, logfile_size, datafile_location, logfile_location from tbl_database_detail_excel1

    open c1

    FETCH c1 into @dbname

    WHILE @@FETCH_STATUS >= 0

    BEGIN

    select @db = 'select ' + '''' + @db + '''' + ', name, ceiling((size * 8192.0)/(1024.0 * 1024.0)), case when status & 0x100000 = 0 then convert(varchar,ceiling((growth * 8192.0)/(1024.0*1024.0))) + '' MB''' + char(10)+char(13)

    + 'else convert (varchar, growth) + '' Percent''' + char(10)+char(13)

    + 'end' + char(10)+char(13)

    + 'from [' + @db + '].dbo.sysfiles'

    exec (@db)

    fetch c1 into @db

    end

    close c1

    end

    when i exceute this sp, the error shows "Invalid object name 'database_growth' ". so please do something for me to resolve this problem.

Viewing 0 posts

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