Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the files from a file group
Message
From
10/06/2015 11:22:59
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Getting the files from a file group
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01620835
Message ID:
01620835
Views:
57
The following command get the objects related to a file group:
SELECT OBJECT_NAME(object_id), *
FROM sys.data_spaces ds
INNER JOIN sys.allocation_units au ON
	ds.data_space_id = au.data_space_id
INNER JOIN sys.partitions p ON
	au.container_id = 
		CASE 
			WHEN au.type = 2 THEN p.partition_id
		ELSE p.hobt_id 
		END
WHERE ds.name = 'MyFileGroup'
This gives one record. In that record, there is not really any user friendly name of which file it is. Anyone would know, from there, what to do to get the file so I can remove the file first and then retry this command:
ALTER DATABASE MyDatabase REMOVE FILEGROUP [MyFileGroup]
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform