Reputation: 4075
I am writing an update trigger and accessing the 'inserted' table to see which rows have been modified.
I have two related questions :
Does the inserted table always contain all the columns of the real table?
If the inserted table contains only the columns that have changed, will there always at least be the primary key columns in the inserted table?
Upvotes: 0
Views: 61
Reputation: 239646
Yes, it includes all columns from the original table, except:
SQL Server 2012 does not allow for text, ntext, or image column references in the inserted and deleted tables for AFTER triggers.
(Similar language, with different version numbers, exists for older versions of SQL Server)
Ask yourself how useful they would be if only a single (non-key) column was updated. You could tell that an update had occurred but you'd be unable to do any further useful processing.
Upvotes: 2