Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts

    logging all mssql activity

    is there any simple way i can get all the sql thats been run on a database (im guessing it stores it somewhere cos if you dont "back up" the transaction logs ur db is like 20gig a month..

    if there is no way to read the logs is there a way to easily put a trigger on every element/table to log the sql that triggered it to a new table? otherwise i will just have to put a new table in with 1 field for each table and a trigger on every table to just increment the corresponding field.

    the reason for this is i used to have a huge cluttered korean database so i rebuilt it but for the new version of the software i need an extended database so its getting all messy and i dont know what do delete (last time i cut it down from 110 tables to 8.. the rest simply were never used.. but this one is much more complicated and all korean).. anyway i cant get to see what sql is actually run as its all embeded in the program itself (well some is SPs but i cant see which of these are used)

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    run SQL profiler (comes with Microsoft SQL Server Client tools), this will show you what is going on on your database. You can log all the SQL etc to a table or a log file and then examine it later to figure out what tables are being used.


  •  

    Posting Permissions

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