Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatically insert the server's datetime
Message
 
 
To
31/05/2001 12:04:34
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00513068
Message ID:
00513269
Views:
13
This message has been marked as a message which has helped to the initial question of the thread.
>>Keep in mind, however, that will only take care of inserted records. To update existing records, simply place the GetDate() function in your update command for your datetime field.
>>
>>i.e.: SQLExec(lnHandle, "Update TableName Set DateTimeField=GetDate() Where Condition")
>>
>>That should take care of the updates for you.
>>
>Yes, you're right. But is there a way to set a trigger to update only the update records?
>
>The 'CREATE TRIGGER FOR UPDATE' updates all the records with the new datetime.
>
>Can you help?
>
>Thank you.

What does your trigger look like (code example)? It doesn't sound like you have a where clause on your Update statement.

The updated records can be accessed using the special internal table Inserted within the trigger. You can declare a cursor and loop through it to update invidual records or you could use that in a subsuqery.
update mytable set DateTimeField=GetDate() where KeyField In (select KeyField from Inserted)
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform