These posts were previously published on the DBA Stack Exchange site, and have been cross-posted here for ad-free posterity. I’m no longer active with responding to questions on the Stack Exchange Network, and consider these to be the canonical links for my answers. If I update any of my responses to correspond to changing technology, they will only be updated on my own site, and not on the Database Administrators Stack Exchange site.

Database context for sys.databases and sys.master_files
Question I have a query that pulls information for a database from the following tables sys.master_files sys.databases sys.filegroups Currently, the context set is the specific database which I want to query about. But if the database is in a mode such that USE DB_NAME doesn’t … [Read More]