[posted and mailed, please reply in news]
Steve (stevesusenet@yahoo.com) writes:
[quoted text, click to view] > However, since we change a part of the schema ( we have an app that
> generates the database tables unique to each client ) for each client
> I would like a scheme that would not involve having to create a
> different trigger for each new table.
It seems to me that this is the gist of your problem.
The "proper" design of this, would be to add one column to each table
that specifies which client the row relates to. If you do this, then
you have no problems with your triggers.
Now, you may not want to this, if you don't want clients to see each
other's data. This can be addressed with views, but if you don't do
things right, your clients may be very angry with you.
Yet an alternative would be give each client his own database. This
separates them even more. You could have a model database, from which
the app could create a new database with a RESTORE COMMAND. That model
database would include your tables and trigger.
[quoted text, click to view] > I was thinking of making a large stored procedure and putting an
> identical call to that procedure in each table.
>
> Each table would have the same trigger in it that would get fired when
> the record was altered. It would call the stored procedure with
> relevent arguments to update the schedule.
But then that table would have to use dynamic SQL to determine which
tables to operate, and that would be messy.
Can you not just change the app, so that it creates the triggers too?
That seems to be the simplest solution.
--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se
Books Online for SQL Server SP3 at