View Full Version : logging all mssql activity

Aug 21st, 2005, 04:31 PM
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)

Sep 1st, 2005, 01:46 AM
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.