October 2, 2008 at 2:54 am
I need to update a specific field in another table when one field in my table gets updated.
Table that is getting updated: tbltimesheet
Fields that could change: comments
pk field : timesheetid
Table to update: tblweek
field: status
Forign key field:timesheetid
The goal is to update the status field when comments field gets updated. I wanted to use update trigger .I am using SQL SERVER .any help would be appreciated.
October 2, 2008 at 3:50 am
From online BOL:
IF UPDATE (column)
Tests for an INSERT or UPDATE action to a specified column and is not used with DELETE operations. More than one column can be specified. Because the table name is specified in the ON clause, do not include the table name before the column name in an IF UPDATE clause. To test for an INSERT or UPDATE action for more than one column, specify a separate UPDATE(column) clause following the first one. IF UPDATE will return the TRUE value in INSERT actions because the columns have either explicit values or implicit (NULL) values inserted.
http://msdn.microsoft.com/en-us/library/aa258254(SQL.80).aspx
David
@SQLTentmaker“He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply