I don't believe SQL Server provides any built-in functions for capturing
this type of information. It does however provide the SQL Profiler tool
through which you can filter and capture all database activity including the
statements being executed. Profiler run independent of process submitting
the requests so you're trying to intercept database calls before they happen
with the intent of preventing one you don't want, Profiler won't do this.
Through C# and your application's data access layer you could always do some
form of customization that traps the information and since you're in
control, you can decide to let it execute or filter as necessary.
(Please reply to the newsgroups only.)
> I need to get the table name(s) and the column name(s) present in a query
> before it is executed against the database. Are there any built-in
> functions (in SQL Server or in C#)? I came to know about "ODBC minimum SQL
> Grammar" from MSDN. Anyone knows whether it'll serve my problem.
> Arrun S