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 )
Solomon Rutzky commented
I originally submitted this suggestion via: