help with this syntax

  • Hi,

    how can i insert into one row the size of the LDF and the MDF from sysfiles,if i have this table and query?

    CREATE TABLE DBSize (DBName sysname, SizeMBTotal int,SizeMDF int,SizeLDF int)

    example = insert DBSize select db_name(), round(sum((/128.0)),2),'SizeOfMDF','SizeOfLDF' from sysfiles

    THX

  • insert into DBSize

    select db_name(), round((sum())*8,2) as [SizeMBTotal],

    (select *8 from sysfiles

    where filename like '%.mdf')SizeMDF,

    (select *8 from sysfiles

    where filename like '%.ldf')SizeLDF

    from sysfiles

    Please let me know if this was of help to you. 🙂

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply