Search code examples
t-sqlsql-server-2000

tsql to get data files growth type in SQL 2000


I want to know the growth type (% or MB) for database files on SQL server 2000. I Used sys.database_files files on Microsoft SQL Server 2005 to get this information. I tried using sysfiles on Microsoft SQL Server 2000 for this, but it wasn't good enough.


Solution

  • This query should help:

    SELECT
      name,
      size,
      growth,
      status,
      size * 8 AS size_in_kb,
      size * 8 / 1024. AS size_in_mb,
      CASE WHEN status & 0x100000 > 0
           THEN growth 
           ELSE NULL END AS growth_in_percent,
      CASE WHEN status & 0x100000 = 0 
           THEN growth * 8 / 1024. END AS growth_in_mb  
    FROM sysfiles