Query executes with no error but not in trigger
- by liaqat ali
I am facing a strange problem in creating trigger in MS SQL.
I have a query that executes with out an error but when I place it within trigger body, it gives error
Invalid column name 'ScreenName'.
I am placing whole trigger code here. Please trace the issue.
CREATE TRIGGER [dbo].[tr_tbFieldLabels_FieldLabelLength] ON [dbo].[tbFieldLabels]
AFTER INSERT
AS
Update tbFieldLabels
Set TextBoxLength = (SELECT top 1 TextboxLength
FROM tbFieldLabelsSource FLS
WHERE FLS.ScreenName = Inserted.ScreenName
AND tbFieldLabelsSource.SystemName = Inserted.SystemName)
FROM tbFieldLabels , Inserted WHERE tbFieldLabels.ID = Inserted.ID
GO
Please help me ASAP.