Sql server trigger : Invalid 'inserted' object name

1.3k Views Asked by At

I have a table that I want to test on it a trigger I try to SELECTED the line of the query to see what the table contains but an error appear and In all MY sql project inserted and deleted table doesn't work for me this is what I wrote

the is the error that appear (On the Image)

CREATE TRIGGER TR
    on Ligne 
    for insert 
    as 
    begin
        select * from inserted
    end

enter image description here

please is there any solution for this problem and thanks

I find that when i hover on inserted it show me this enter image description here

2

There are 2 best solutions below

0
ahmed abdelqader On BEST ANSWER

Have you made sure intellisense is enabled in SSMS ?

Go to Tools >> Options >> Text Editor >> Transact-SQL >> IntelliSense

enter image description here

Then - if it is enabled - sometimes it helps to refresh the local cache:

enter image description here

7
CodeName On

Have you tried placing an i at the back of the keyword, inserted?

CREATE TRIGGER TR
    on Ligne 
    for insert 
    as 
    begin
        select * from inserted i
    end