August 12, 2003 at 1:48 pm
Does anyone have any ideas on a query that I can run to retrieve all logical file names (including path names) for a list of DB's? It needs to include both DB and TXLOG.
Thank you.
August 12, 2003 at 2:14 pm
declare @dbname varchar(50)
declare dbname cursor
for select name from master..sysdatabases
open dbname
fetch next from dbname into @dbname
while @@fetch_status = 0
begin
select @message = 'select name, filename from ' + @dbname + '..sysfiles'
execute (@message)
fetch next from dbname into @dbname
end
deallocate dbname
Edited by - allen_cui on 08/12/2003 2:15:32 PM
August 13, 2003 at 12:03 am
Hi Carl,
quote:
Does anyone have any ideas on a query that I can run to retrieve all logical file names (including path names) for a list of DB's? It needs to include both DB and TXLOG.
another way could be
sp_MSforeachdb @command1 = "use ? select name, filename from sysfiles"
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply