Results 1 to 3 of 3

Thread: Extracting Used Tables from SQL query

  1. #1
    Senior Member
    Join Date
    Feb 2004
    Posts
    1,891
    Thanks
    218
    Thanked
    61 times in 53 posts
    • jonathan_phang's system
      • Motherboard:
      • Asus Rampage III Extreme
      • CPU:
      • i7 930 @ 4.2 ghz (200x21)
      • Memory:
      • 12GB Corsair XMS3 1600
      • Storage:
      • Crucial M4 128GB SSD + Misc Data Drive
      • Graphics card(s):
      • EVGA GTX 1080 FTW
      • PSU:
      • Corsair HX850 Modular
      • Case:
      • Antec 300
      • Operating System:
      • Windows 7 x64
      • Monitor(s):
      • Asus PB278Q (27" 2560x1440)
      • Internet:
      • Virgin Media 100mb

    Extracting Used Tables from SQL query

    Quick one. I have lots of SQL queries and need to determine which tables are being used by all of them in total (So that I can figure out the dependencies). Is there a way of being able to extract the table names from the queries, otherwise I guess that i will have to manually verify them.

    Thanks for any help, JP

  2. #2
    Gentoo Ricer
    Join Date
    Jan 2005
    Location
    Galway
    Posts
    11,048
    Thanks
    1,016
    Thanked
    944 times in 704 posts
    • aidanjt's system
      • Motherboard:
      • Asus Strix Z370-G
      • CPU:
      • Intel i7-8700K
      • Memory:
      • 2x8GB Corsiar LPX 3000C15
      • Storage:
      • 500GB Samsung 960 EVO
      • Graphics card(s):
      • EVGA GTX 970 SC ACX 2.0
      • PSU:
      • EVGA G3 750W
      • Case:
      • Fractal Design Define C Mini
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • Asus MG279Q
      • Internet:
      • 240mbps Virgin Cable

    Re: Extracting Used Tables from SQL query

    You could knock together a quick script to get a list of table names from the database and extract the strings matched against the SQL queries, whichever strings dont match are the unused ones.
    Quote Originally Posted by Agent View Post
    ...every time Creative bring out a new card range their advertising makes it sound like they have discovered a way to insert a thousand Chuck Norris super dwarfs in your ears...

  3. #3
    Registered+
    Join Date
    Aug 2008
    Posts
    22
    Thanks
    0
    Thanked
    1 time in 1 post

    Re: Extracting Used Tables from SQL query

    SHOW TABLE STATUS on a database will display a bunch of information, for
    some engines this includes the last check time and the last update time, so
    that might give you what you need.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 17
    Last Post: 15-07-2007, 03:59 PM
  2. RMA Query
    By billythewiz in forum SCAN.care@HEXUS
    Replies: 7
    Last Post: 07-11-2006, 05:44 PM
  3. Final SQL problem - but it ain't too easy
    By Bazzlad in forum Software
    Replies: 4
    Last Post: 28-07-2006, 10:10 AM
  4. SQL Server Connection string?
    By Stoo in forum Software
    Replies: 7
    Last Post: 04-05-2005, 05:48 PM
  5. SQL Query
    By Basher in forum Software
    Replies: 5
    Last Post: 11-01-2005, 04:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •