Monday, March 26, 2012

How do I know if a column is updated?

Hi,
In SQL Server 2000, how do I know that a paricular column in a Table row is
updated?
e.g., in Customer(ID, Name, SSN, DoB, Address),
the (0001, John, 123456789,1980/01/02,'1234 Main Street'),
where the '1234 Main Street' is updated.
Thanks for help.
Jason
You could respond to the change in an UPDATE trigger. In the trigger
you can use the IF UPDATE()
<http://msdn.microsoft.com/library/de...es_08_7377.asp>
clause to determine if any particular column has been changed. For example,
CREATE TRIGGER MyUpdateTrigger ON dbo.MyTable
FOR UPDATE AS
IF UPDATE(MyCol)
BEGIN
...
END
GO
where MyCol is a column in dbo.MyTable that you want to respond to
changes on.
*mike hodgson*
http://sqlnerd.blogspot.com
Jason Huang wrote:

>Hi,
>In SQL Server 2000, how do I know that a paricular column in a Table row is
>updated?
>e.g., in Customer(ID, Name, SSN, DoB, Address),
>the (0001, John, 123456789,1980/01/02,'1234 Main Street'),
>where the '1234 Main Street' is updated.
>Thanks for help.
>
>Jason
>
>

No comments:

Post a Comment