문제

Can a specific cell wise trigger be created?

Or is

IF UPDATE(COLUMN) WHERE OTHER_COLUMN LIKE 'JT'

the equivalent present in SQL Server 2008?

EDIT after getting 2nd answer---

IF not UPDATE(CurrentNo) --// Wanted to do like this : where series ='JT'
    return

IF not EXISTS(SELECT 'True'
              FROM Inserted i
              JOIN Deleted d ON i.Series = d.Series
              WHERE i.Series = 'JT' AND d.Series = 'JT')
    return

Seems ok right! Please comment.

도움이 되었습니까?

해결책

No. There is no way of doing this declaratively. You would need to create a general Update trigger and put logic in it to return immediately IF NOT UPDATE (column)

If the column of interest was updated then you would query the inserted and deleted pseudo tables to allow you to process rows where your condition of interest was met.

다른 팁

Tiggers are specified on tables, not on rows, columns or cells. Inside the body of the trigger you will have access to the INSERTED and DELETED tables. You can join them together to deterimine which columns were changed during an update. The UPDATE() function which is available in SQL Server 2008 (as well as previous versions) is a shorthand method for determining whether a column has changed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top