Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2012
>>Naomi, Because you run only procedure for create tracking trigger. Simply, fast...
>>
>>Don Freeman, where you fill variable @TipID?
>>
>>MartinaJ
>>
>I agree with what Kevin wrote. There is no need to overcomplicate the trigger with dynamic SQL.
All -
Thanks for your feedback (I think). To expand a little further on this matter, as I said in the original post, I found this code on the internet. Actually, I found the code that generated this code, on the internet. I was looking for a way to create triggers for an audit table and it works well, although I confess it is mostly Greek to me. I can write fairly well in VFP (and have done this in VFP) but this is my first venture into SQL scripting and it is pretty confusing. Martina answered Naomi's original question. It was fast and easy. The script I found generated the audit table AND triggers for every table in the database. (There are about 40 of them.) So it was fast and easy to create, if not necessarily fast to run. BUT, while this is a large database, it has a fairly small number of users and not a ton of traffic. So transaction speed is not a particular concern.
Martina asks where do I populate the value of @TipID. The answer is I guess I don't. That is probably my problem. While I look at the code I don't see how/where the other parameters are populated either. So if I knew how to do that I could probably solve it.
Both Kevin and Naomi suggest there is a simpler and more straightforward way. I am sure there is, and if either of you have an example to share I would be glad to rewrite this thing along simpler lines. But at this point I can't see how to get the old and new values that need to be logged.
Anyone have any more for me?
Thanks
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement