Fog Creek Software
Discussion Board

watching what sql server does

I'm trying to debug a program that inserts some data into a sql server database. I don't have the source code to the program. However I do have access to the database.

The insert statement is inserting a row into one obvious table. It is also inserting a row in to one or more other tables. (there are like 300 tables). It may also be executing one of very many stored procs to do these inserts.

Is there a way to monitor SQL server (some loggging mode, etc) so that I can see what other tables are being modified, and what stored procs are being triggered?

sql noob
Tuesday, October 7, 2003

Yes the SQL Profiler can trace all the SQL calls. Should be available with the client tools.

Tuesday, October 7, 2003

other than profiles, do it thru an odbc connection and set logging on (in control panel odbc connections).

Tuesday, October 7, 2003

In reference to the ODBC logging: Be advised:

(a) This will only work with ODBC. If you're using another data access technology this won't help.

(b) ODBC logging this seriously degrades performance. Be sure to turn it off when you're done collecting your performance metrics.

(c) To reitterate, don't forget to turn off the ODBC logging. I once forgot to do it and found about a Gig-And-A-Half log file sitting on my hard drive.

I think the SQL Profiler is the better way to go. You'll get far more information with this, it's easier to use too.

Sgt. Sausage
Tuesday, October 7, 2003

Slightly off-topic (SQL Profiler is what you need here), but to watch what SQL Server does, you may also try to launch SQL Server on the command-line (sqlservr.exe) - especially useful if you want to see what is happening at startup.

Friday, October 10, 2003

*  Recent Topics

*  Fog Creek Home