• ok i did a little bit more: i'm joining against all databases, so i can find things that were never accessed; on my test server i see a lot of db's that fit that description, and on production, there's just one database that hasn't been touched since the last reboot;all the others show dbs with more frequency.

    hope this helps :

    ;;WITH myCTE AS

    (

    SELECT

    DB_NAME(database_id) AS TheDatabase,

    OBJECT_NAME(object_id,database_id) As TheTableName,

    last_user_seek,

    last_user_scan,

    last_user_lookup,

    last_user_update

    FROM sys.dm_db_index_usage_stats

    ),AllDbs

    AS

    (

    SELECT name AS TheDatabase from master.sys.databases

    )

    SELECT

    ServerRestartedDate = (SELECT CREATE_DATE FROM sys.databases where name='tempdb'),

    db.TheDatabase,

    MAX(x.last_read) AS last_read,

    MAX(x.last_write) AS last_write

    FROM AllDbs db

    LEFT OUTER JOIN

    (

    SELECT TheDatabase,TheTableName,last_user_seek AS last_read, NULL AS last_write FROM myCTE

    UNION ALL

    SELECT TheDatabase,TheTableName,last_user_scan, NULL FROM myCTE

    UNION ALL

    SELECT TheDatabase,TheTableName,last_user_lookup, NULL FROM myCTE

    UNION ALL

    SELECT TheDatabase,TheTableName,NULL, last_user_update FROM myCTE

    ) AS x

    on db.TheDatabase = x.TheDatabase

    GROUP BY db.TheDatabase

    ORDER BY db.TheDatabase

    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!