I need to create a date updated field for ms sql 2000. The current trigger I have only works for the insertion of data and it is "(getdate())" is there one that I can use for insertion and update of fields?

Ta,

Slade

Recommended Answers

All 2 Replies

I need to create a date updated field for ms sql 2000. The current trigger I have only works for the insertion of data and it is "(getdate())" is there one that I can use for insertion and update of fields?

You can write a trigger that fires on both insert and update:

CREATE TRIGGER <trigger_name>
ON <table_name>
FOR INSERT, UPDATE
AS
<trigger_body>

Here's the T-SQL reference page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_create2_7eeq.asp

commented: Thanks, here's your reward :P +36

Thankyou very much, your help will not go unrewarded.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.