July 6, 2011 at 8:23 am
The title says it all! I want to know is there a DMV or anything in sql that logs what is happening with a select before the actual select happens? You know can you track/capture a select from a specific Login?
July 6, 2011 at 8:27 am
Server-side trace. The T-SQL:StmtStarting event
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 6, 2011 at 8:34 am
Gail
I take it that would not allow me to do anything before it has taken place tho?
July 6, 2011 at 8:38 am
i'm with Gail; all you can do is trace it...so i don't think so; for example the DMV's that have the execution plans for a given statement would occur after the statement was started, but maybe before the statement was completed...
are you trying to prevent a select from occurring, or do you need to audit/track a select? maybe there's a different way to do what you are after.
Lowell
July 6, 2011 at 8:41 am
No I actually want to capture it and alter then return the results before returning values!
July 6, 2011 at 8:46 am
Write a stored procedure and make them call that rather than running ad-hoc queries.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 6, 2011 at 8:58 am
Write a stored procedure and make them call that rather than running ad-hoc queries.
--------------------------------------------------------------------------------
Gail Shaw
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Gail
Interesting but how do you capture the select with a stored proc? I can not use a trigger because it does not have a way to kick off on the select.
July 6, 2011 at 9:09 am
You don't. You tell whoever wrote the app that they must call stored procs not run adhoc queries.
Frankly the idea of modifying the returned data is terrifying. If I could send a SELECT * FROM foo but get back the rows from the table bar instead it could be a major mess.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 6, 2011 at 9:17 am
GilaMonster (7/6/2011)
You don't. You tell whoever wrote the app that they must call stored procs not run adhoc queries.Frankly the idea of modifying the returned data is terrifying. If I could send a SELECT * FROM foo but get back the rows from the table bar instead it could be a major mess.
I've seen views that manipulate data based on username, or if the user is in a certain role or not...you know, so it's hides credit card numbers and stuff like that.
unless you take away the ability to adhoc query the raw tables, and as gail said, send them the data vie procs or views or something that encompasses that "instead of this givem that", you are stuck. they get what they ask for from the tables.
Lowell
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply