Query executes with no error but not in trigger

Posted by liaqat ali on Stack Overflow See other posts from Stack Overflow or by liaqat ali
Published on 2012-12-05T04:10:17Z Indexed on 2012/12/05 5:04 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about sql

Related posts about query