|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Mdf and Ldf filesIs there some sort of command that can tell me which mdf and ldf files are
associated to which databases? Thanks, Ninel SELECT filename, db_name(dbid)
FROM master..sysaltfiles ORDER BY dbid; "ngorbunov via SQLMonster.com" <u9125@uwe> wrote in message news:65fefd3e38aeb@uwe...Show quote > Is there some sort of command that can tell me which mdf and ldf files are > associated to which databases? > > Thanks, > Ninel > > -- > Message posted via http://www.sqlmonster.com > There may be an easier way to do this, but this will work:
CREATE TABLE #t (dbname sysname, filename sysname) INSERT INTO #t (dbname, filename) exec sp_msforeachdb 'USE ?; SELECT ''?'', filename from sysfiles' SELECT * FROM #t ORDER BY dbname DROP TABLE #t ngorbunov via SQLMonster.com wrote: Show quote > Is there some sort of command that can tell me which mdf and ldf files are > associated to which databases? > > Thanks, > Ninel > > -- > Message posted via http://www.sqlmonster.com |
|||||||||||||||||||||||