Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Value of field
Message
De
05/09/2001 09:30:31
 
 
À
04/09/2001 22:41:40
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00552184
Message ID:
00552461
Vues:
17
>>Hi,
>>
>>Is there any way to do one of the following in a trigger?
>>
>>1 - return the value of a field from inserted/deleted tables where the field name is stored in a variable? i.e.
select MythicalEvalFunction(@MyField) from inserted ....
>>
>>2 - return the value of a field from inserted/deleted tables where all you have is the field ID (from the corresponding actual table) i .e.
select MythicalEvalFunction(field_id) from inserted ...
>>
>>TIA,
>
>Ken,
>
>HUH? Would be my response to your questions...
>
>First, what do you mean by RETURN? A trigger is called automatically, who or what are you returning the value to?
>
>Also, what do you mean by the field_id ??? Do you mean the object ID?
>
>Perhaps if you tell us what you are trying to acomplish it would be easier to get you on the right road.
>
>BOb

I am trying to wite a trigger to log changes to a table. The "log" table contains fields for the table changed, the field changed, and the old and new values. The idea is to determine in the trigger, which fields have changed and then make an entry for each field changed into the log table. Using columns_updated() and some bit math, I can succesfully loop around and get the names of the fields that have changed into a variable. I also, at that point, have the column_id (what I previously called the field_id) of the updated field. However, I haven't yet figured an easy way to 'get' the value of the field from the inserted and deleted tables from either the column name or the column_id so I can insert it into the log table.

TIA,
Ken B. Matson
GCom2 Solutions
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform