I have been trying to use an update trigger which checks for the title_id in the primary table. This is what i did:
ALTER TRIGGER [dbo].[EX6] on [dbo].[sales]
INSTEAD OF UPDATE NOT FOR REPLICATION
AS
BEGIN
IF EXISTS(SELECT S.title_id
FROM inserted S
INNER JOIN Titles T On T.title_id = S.title_id)
BEGIN
UPDATE Sales
SET sales.stor_id = inserted.stor_id
, sales.ord_num = inserted.ord_num
, sales.title_id = inserted.title_id
, sales.ord_order = inserted.ord_order,
,sales.qty = inserted.qty
END
However, when i execute this, I am getting the following errors:
the multi-part identifier inserted.stor_id could not be bound
The same error occurs for the rest of the columns used in update command. So, can u please help me out in solving this and successfully update the column in the database..
You have aliased inserted to be
Sso you will need to continue that in yourUPDATEstatementI have updated the answer to reflect changes discussed in chat.