Monday, March 26, 2012

How to make argument/parameter optional in UDF/Trigger?

Hello,
I took over a project, and I need to make updates, modifications, pick up
where the last person left off. There is one table that is used in several
processess from external apps. This table contains an InsteadOf trigger tha
t
I need to disable for just one new procedure that am adding to the project.
I am thinking of using a UDF where I pass a value to the UDF and that value
disables the trigger. But the other processes/procedures which are already
in place obviously do not have a call to this UDF, and I sure don't want to
spend the time hunting down every process/procedure that uses this table (al
l
the external apps). Or alternatively, is there a way to create an optional
parameter in the trigger - where if a value is passed in, the trigger gets
disabled, else trigger does its thing. The other processes/procedures woul
d
not pass in this optional parameter. Is there a way to do this?
Thanks,
RichI think I am getting discombobulated. I don't think you can pass things in
to Triggers. Can you?
I am thinking I could set a value in a support table that only my procedure
would know about and then remove that value from the table when the process
is complete.
"Rich" wrote:

> Hello,
> I took over a project, and I need to make updates, modifications, pick up
> where the last person left off. There is one table that is used in severa
l
> processess from external apps. This table contains an InsteadOf trigger t
hat
> I need to disable for just one new procedure that am adding to the projec
t.
> I am thinking of using a UDF where I pass a value to the UDF and that val
ue
> disables the trigger. But the other processes/procedures which are alread
y
> in place obviously do not have a call to this UDF, and I sure don't want t
o
> spend the time hunting down every process/procedure that uses this table (
all
> the external apps). Or alternatively, is there a way to create an option
al
> parameter in the trigger - where if a value is passed in, the trigger gets
> disabled, else trigger does its thing. The other processes/procedures wo
uld
> not pass in this optional parameter. Is there a way to do this?
> Thanks,
> Rich

No comments:

Post a Comment