Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading uncommitted data
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01426495
Message ID:
01426521
Vues:
36
Hi Sergey,

Let's see if I can explain. I am trying to consolidate data from different databases (for now one is a SyBase DB and the other is Oracle DB and in the future there might be more) as both do the same but in different way, we want to have a single repository of data as well as some extra data for analysis. To this effect I am creating some store procedures that will be scheduled to run every 10 seconds or so to update our tables from the remote systems. In this particular case I am reading the events from the sybase events tables and writing them in our events tables, but some of those events are categorized by us as faults that we want to keep track of, so I write these on a different table, FaultsLog (in here some users can write about what happened etc and not all the Faults are automatically added in this table as there are faults that are not generated by events) using the trigger I posted. Now, the events have a counter-event (for example hopefully after the event "Power Off" there will be an event "Power On" and so) thus when I am adding the events that are the "Clear events (SetFlag = 0) in this case Power On" I need to find the latest entry in the log that corresponds to "Power Off" (which is the counter event of power on and has a SetFlag = 1 in the EventsLog) for the same device, that is what I try to accomplish in the getClearedEventFaultsLogPK function.

Sorry to be so confusing, explaining this things have never being easy for me.
             Scheduled task             Insert Trigger                                 Scalar functions
Sybase Event -> SQL Event -> isFault? -Yes> FaultsLog -> SetFlag = 0? -Yes> Retrieve parent FaultsLog PK (SetFlag = 1)
I think I will move away from updating the parent in the trigger and set them all after all the faults have been created, this should be easier...
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform