4

I have a data set pulled from sys.master_files. The data set looks something like this:

database_id filename         physical_name data_space_id
----------- ---------------- ------------- -------------
6           PRIMARY_06       some location 1
6           primary_09       some location 1
21          PRIMARY_01       some location 1
26          PRIMARY_01       some location 1
52          PRIMARY_01       some location 1
75          PRIMARY_01       some location 1

I would like to join in the FILEGROUP name to this dataset. It should just be a matter of joining on database_id and data_space_id, but I can't seem to find a function or system view analogous to sys.master_files for filegroups/dataspaces.

The brute force method would be to create this list as a temporary lookup using sp_MSForEachDB, but I would like to know if there's a better way.

2

Sorry. Afraid not. you have to query sys.filegroups and/or sys.data_spaces in each database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.