Unanswered: Using Stored Procedues to start/stop sql profiler
Does anyone know if there is a way to create a stored procedure that can start sql profiler when executed, and create another stored procedure that stops the profiler when it is executed. I also want the stored procedures to create, and save a trace file in a directory. I am trying this so my developers can collect traces on their apps. Thanks.
in my apps i accomplish this "tracing" by having a per-client application execution config option TRACE/NOTRACE. the front-end has one statement execution sub, that checks if this option is set, - record the statement into a designated table prior to executing it. very convenient for debugging!
public sub ExecuteSQL(byref obj as object, mSQL as string)
if mTRACEON then
conn.execute("insert dbo.trace_table (user_id, computer_id, date_executed, statement) values ('" & getuser() & "', '" & getcomputer() & "', '" & date & " " & time() & "', '" & fixstring(mSQL) & "')"
if typename(obj) <> "Nothing" then
set obj = conn.execute(mSQL)