Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

Intercept query batch from client to rewrite it or cancel it

Sometimes it is desirable to trap / intercept the batch submitted by the client (ODBC, SqlClient, etc), for various reasons, to possibly rewrite it or even cancel it.

Three instances that have been documented are found on DBA.StackEchange (and I'm sure that there are others):

https://dba.stackexchange.com/questions/84459/manipulate-sql-statement-before-execution-on-server (duplicated on Stack Overflow as: https://stackoverflow.com/questions/27320554/manipulate-sql-statement-before-execution-on-server )

https://dba.stackexchange.com/questions/171143/possible-to-intercept-and-alter-sql-queries-in-the-engine-before-it-gets-execute

https://dba.stackexchange.com/questions/183443/can-i-edit-the-batches-received-by-sql-server-on-the-fly

1 vote
Sign in
(thinking…)
Password icon
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base