• If you remove the where clause in given script then it will display the information about transaction log file coz' the file id of .mdf file is 1 and fileid of .ldf file is 2. The below block of the code will give the required information even if you are having multiple data files I mean primary(.mdf) and secondary(.ndf) or multiple log files because there is no where clause used. Follow the below script.

    Open c

    fetch next from c into @db

    while @@fetch_status = 0

    begin

    Exec ('INSERT #t

    select ''' + @db + ''', filename, name, (size * 8)/1024, maxsize, growth

    from ' + @db + '..sysfiles')

    -- dont use where clause here coz' it will restrict the result

    I have executed above script successfully.

    try it...

    Regards,

    Austin