Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4255744
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:15:36+00:00 2026-05-21T05:15:36+00:00

I have a database with many tables that get used, and many tables that

  • 0

I have a database with many tables that get used, and many tables that are no longer used. While I could sort through each table manually to see if they are still in use, that would be a cumbersome task. Is there any software/hidden feature that can be used on a SQL Server/Oracle database that would return information like “Tables x,y,z have not been used in the past month” “Tables a,b,c have been used 17 times today”? Or possibly a way to sort tables by “Date Last Modified/Selected From”?

Or is there a better way to go about doing this? Thanks

edit: I found a “modify_date” column when executing “SELECT * FROM sys.tables ORDER BY modify_date desc”, but this seems to only keep track of modifications to the table’s structure, not its contents.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:15:37+00:00Added an answer on May 21, 2026 at 5:15 am

    replace spt_values with the tablename you are interested in, the query will give the the last time it was used and what it was used by

    From here: Finding Out How Many Times A Table Is Being Used In Ad Hoc Or Procedure Calls In SQL Server 2005 And 2008

    SELECT * FROM(SELECT COALESCE(OBJECT_NAME(s2.objectid),'Ad-Hoc') AS ProcName,execution_count,
        (SELECT TOP 1 SUBSTRING(s2.TEXT,statement_start_offset / 2+1 ,
          ( (CASE WHEN statement_end_offset = -1
             THEN (LEN(CONVERT(NVARCHAR(MAX),s2.TEXT)) * 2)
             ELSE statement_end_offset END)  - statement_start_offset) / 2+1))  AS sql_statement,
           last_execution_time
    FROM sys.dm_exec_query_stats AS s1
    CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s2 ) x
    WHERE sql_statement like '%spt_values%'  -- replace here
    AND sql_statement NOT like 'SELECT * FROM(SELECT coalesce(object_name(s2.objectid)%'
    ORDER BY execution_count DESC
    

    Keep in mind that if you restart the box, this will be cleared out

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following tables in my database that have a many-to-many relationship, which
I have a table within my database that has many records, some records share
Many applications have grids that display data from a database table one page at
I have database with many tables. In the first table, I have a field
I have many tables in my database which are interrelated. I have a table
I have a table in a SQL Server 2005 Database that is used a
I have a star schema type data base, with fact tables that have many
I have an access database with many tables. I am looking for a field
I have a very large Oracle database, with many many tables and millions of
I have a database that many different client applications (a smattering of web services,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.