• there's a VALUES command hanging out there, and the column names should not be in single quotes;

    create table PendingIO (

    [database] varchar (100),

    Physical_name varchar (100),

    io_pending int,

    io_pending_ms_ticks int,

    io_type varchar (20),

    num_of_reads int,

    num_of_writes int,

    time_stamp datetime default getdate())

    INSERT INTO PendingIO ( [database],Physical_name,io_pending,io_pending_ms_ticks,io_type,num_of_reads,num_of_writes)

    SELECT

    DB_NAME(mf.database_id) AS [Database],

    mf.physical_name,

    r.io_pending,

    r.io_pending_ms_ticks,

    r.io_type,

    fs.num_of_reads,

    fs.num_of_writes

    FROM sys.dm_io_pending_io_requests AS r

    INNER JOIN sys.DM_IO_VIRTUAL_FILE_STATS(NULL, NULL) AS fs

    ON r.io_handle = fs.file_handle

    INNER JOIN sys.master_files AS mf

    ON fs.database_id = mf.database_id

    AND fs.file_id = mf.file_id

    ORDER BY

    r.io_pending,

    r.io_pending_ms_ticks DESC;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!