Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning trigger

Status
Not open for further replies.
Mar 12, 2003
678
0
0
US
I am new to creating triggers and was wondering if any one new the syntax and how to create a trigger that will warn a user that they are about to save a wrong Account Number? I want them to be able to save it, but just warn them so it will make them check to make sure it is correct.
 
This type of data checking should be done by the front-end, not SQL Server.
 
I would be creating the trigger on the tables that are related to the front end. Does this matter?
 
It would be easier to run a query from the front end to validate the acct#. Not sure what your critera would be. For example ..what I have done in the past is check if an acct# exists. I do a simple select count(*) from table where acct# = @acct#. Then return the result to the front end. If > 0, then the account exists and tell the user it exits.
 
I am trying to add a trigger to an existing application where I can not add code to the front end. That is why I am trying to create a trigger on the back end.
 
W ell, the front end code would still need to be modified even if you create the trigger. This is because the trigger could raise an error, but the front end would have to know what to do with it. Either way you go, the front end code would need to be changed.
 
Yes, but it won't show up in the front end app unless you code for it.
 
Thanks for your input, I guess i will have to forward it on to our developers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top