USE SampleDatabase;
EXEC sp_helpfile;
returns physical paths of current database( SampleDatabase)...
What if the DBA needs to change/move physical data files of all databases to another location ?
In these cases and there are hundereds of databases in an instance, DBAs need to fetch physical storage paths for each database...
EXECUTE master.sys.sp_MSforeachdb 'USE [?]; EXEC sp_helpfile'
master.sys.sp_MSforeachdb -- This undocumented SP is useful to loop through all databases...