Keeping a running trace file of users SQL
Posted on 2006-10-26
I have Microsoft SQL 2000 Cluster up and running. I'd like to get a running trace of users SQL - but I really don't want to have to manually start the SQL profiler and set up a trace file each and every time.
What I would like to do is either get a batch process started up - or use the microsoft SQL Server agent - to start up a process - maybe a stored procedure perhaps. I'd then like to "capture" all SQL coming into the database and store the userID, date, time, and TSQL into a text file. I'd like to also ensure that there is a filter - 99% of SQL comes in from an application that uses a user ID of "OWUSER" - so I don't want to see any of that SQL at all - just the users SQL.