May 2, 2006 at 3:50 am
Hi all,
I need to write a stored procedure which will return file details for all the user databases on a server.
Ideally I would like the following information per db:
database, data file name, data physical file name, data status (attached/detached)
database, log file name, log physical file name, log status (attached/detached)
I've looked at the sysfiles system table, but I'm having trouble working out the status flags.
Thanks.
May 2, 2006 at 4:17 am
From books online
status | int | Status bits for the growth value in either megabytes (MB) or kilobytes (KB). 0x2 = Disk file. 0x40 = Log file. 0x100000 = Growth. This value is a percentage and not the number of pages. |
so the status just tells you whether the file is data or log. I don't think there's any way to get a list of detached databases, since once you detach, the database doesn't exist as far as SQL is concerned.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply