Question: I am new to triggers 
i have two tables with names ArefSms And tblSalesProd

i want after an insert my trigger update ArefSms where tblSalesProd.SalesID=ArefSms.SalesID
for this propose i write below code 

```
USE [ACEDB]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[areftblSalesProd] ON [dbo].[tblSalesProd]
AFTER INSERT
AS
Begin Try
Update ArefSms 
       set
        qt=inserted.ProdQty
        where ArefSms.SalesID=inserted.SalesID

End Try
Begin Catch

End catch

```

but now i have error 

```
Msg 4104, Level 16, State 1, Procedure areftblSalesProd, Line 9
The multi-part identifier "inserted.SalesID" could not be bound.

```

What can I do?

Answer: 
You need to specify `inserted` in the `update` statement. It is a table reference:

```
Update ArefSms 
    set qt=inserted.ProdQty
    from inserted
    where ArefSms.SalesID=inserted.SalesID;

```
When updating tables from other tables (in this case `inserted`), I prefer the syntax using `JOINs`:

```
UPDATE Aref
SET Aref.qt=inserted.ProdQty
FROM ArefSms Aref
   INNER JOIN inserted ON Aref.SalesID=inserted.SalesID

```

* [Condensed Fiddle Demo](http://sqlfiddle.com/#!3/25771/1)