RE: passing table to store proc
From: Ryan (Ryan_at_discussions.microsoft.com)
Date: 01/07/05
- Next message: Aaron [SQL Server MVP]: "Re: calculate the midle and end of the month"
- Previous message: James: "Re: calculate the midle and end of the month"
- In reply to: Zeng: "passing table to store proc"
- Next in thread: Matthew: "RE: passing table to store proc"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 7 Jan 2005 15:01:02 -0800
There is no real way to pass tables to a stored proc (SP).
Two potentialities that come to mind...
Can you create a table function that does most of you joins and logic, and
then just join the Inserted and/or Deleted to it? That way each of you
triggers would be much smaller, and the code not replicated?
The other route would be to insert from the inserted/deleted to a
intermediary table and then just have the SP join to that. The difficulty
with that, is that multiple triggers inserting into the same table, and
multiple instances of the SP running might cause some problems. But you
could work around this if the SP didn't have to be instant, by scheduling the
SP to run every X minutes/hours/whatever.
Ryan
Remember vague questions get vague answers...
"Zeng" wrote:
> I am trying to monitor a set of tables (containing data for multiple
> companies) for any update, inserted, or deletion using trigger, if there is
> such event happens to certain set of companies, I'll have to update another
> table. Basically I'm implementing data caching invalidation.
>
> The problem is, the triggers are the same for all tables but I can't share
> the code by extracting the common code and put it into the store procedure
> and have all triggers call the store proc. The reason is...there is no way
> to pass the inserted and deleted table to store procedure, does anybody have
> comment or suggestion that I can have all of the triggers share the same
> code? Thanks!!
>
>
>
- Next message: Aaron [SQL Server MVP]: "Re: calculate the midle and end of the month"
- Previous message: James: "Re: calculate the midle and end of the month"
- In reply to: Zeng: "passing table to store proc"
- Next in thread: Matthew: "RE: passing table to store proc"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|