Link to home
Start Free TrialLog in
Avatar of dbdoshi
dbdoshi

asked on

Trigger on SELECT

Hello, I am trying to write a trigger which will allow me to intercept a SELECT statement and depending on the WHERE clause in the SELECT statement, I want to output a resultset. For example,

SELECT col FROM A WHERE x = 5;

Ordinarily, it might return

xyz
abc
pqr

Now, if the above query executes against the server, I want to catch it before it executes and return something like

mno

Thus, depending on where clause I wish to manipulate the resultset.

Thanks.
Avatar of ruperts
ruperts

can't do that...

Triggers only fire on update/delete/insert.


Avatar of curtis591
Could you maybe use a stored procedure for something like this instead of a trigger?
Well a view is the closest thing I could think of..
Avatar of dbdoshi

ASKER

Yes, anything will go. View or Stored Proc? Can somebody give a little example.
ASKER CERTIFIED SOLUTION
Avatar of curtis591
curtis591

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial