sys.master_files.state_desc - OFFLINE vs ONLINE Status ??

  • Hello,

    MSSQL2005/SP2 on Win2003Server/SP2

    SELECT name, physical_name AS CurrentLocation, state_desc

    FROM sys.master_files

    WHERE database_id = DB_ID(N'my_databasename');

    The above query returns ONLINE for column "state_desc" from the table sys.master_files. However, if I change the database to OFFLINE using either ALTER DATABASE or via SS Management Studio, running the above query still returns the db status as being ONLINE ??

    Any thoughts?

    Many thanks. Jeff

  • FILE state <> DATABASE state. your query returns FILE states not DATABASE states:

    From BOL:

    In SQL Server 2005, the state of a database file is maintained independently from the state of the database.


    * Noel

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

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