[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2495
  • Last Modified:

Passing parameter to a Trigger

Can I pass parameters to a Trigger?
0
rpkhare
Asked:
rpkhare
  • 3
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
"no", as you do not call a trigger. a trigger has only the data available for which rows have been updated/deleted/inserted, and all the data in the tables.

what are you trying to achieve?
0
 
rpkhareAuthor Commented:
Actually I want to update an old record in a table in which a new record is inserted. From your answer it seems that I'll have to write a Stored Procedure.
0
 
UmeshCommented:
I'm agree with Angelll on can't pass parameter directlyto triggers bcoz you do not call a trigger.

But how about calling a stored procedure inside a trigger and availing the required parameter???

Inside trigger you call a sp like this..

call uNeedParameter(OUT param1);

or

call uNeedParameter(@param1);

Later you can use ' param1' in the body of trigger?

Does it make sense?

0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
rpkhareAuthor Commented:
Will it be an overhead or not? What is the advantage of calling a Stored Procedure from a trigger?
0
 
UmeshCommented:
Khare-

Personally I feel like trigger itself is a overhead.. and calling a SP inside is adding some more sugar...
Coming to advantage... just take your example you wanted to pass parameter to trigger but trigger can't be directly called..so what you do is..call a sp inside a trigger and use the parameter..

Thanks,
Umesh
0
 
rpkhareAuthor Commented:
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now