I'm dot.net developer, and i'm working a lot with MSQL. My current task is when some user executes select query on database, i should "catch" the query data. What do i mean is if select query is "select * from UsersTbl where UserID = 5", i have to get '5'. Does somebody have any idea where to start???
This is an usual requirement - usually people only want to audit changes to data.
There are only a few options to my knowledge (I don't think SQL 2008 introduced any auditing of this nature).
If ALL access is via stored procedures then I think this is best logged by the procedure code. If people access the base tables then the only way to log this is using traces, logging the SQL Statement executed. Note that this has quite an overhead, will generate a lot of data and may have an unacceptable impact on the performance of the server if the number of requests is high.
Profiler uses traces - it is simply a GUI for them. I would recommend using server side traces rather than profiler, however you can use profiler if you must. At the very least run it on another machine.