I'm trying to insert a QuoteNumber from a table called AccountInfo into a table call ShippingInfo where the columns ShippingIdentity match, but I keep getting this error when I try to run this code. The line that throws the error is: inner join inserted on ShippingInfo.ShippingIdentity = a.ShippingIdentity. Can someone please tell me why? Thanks for any help.
ALTER TRIGGER InsertQuoteNumber
ON AccountInfo
FOR INSERT
AS
BEGIN
INSERT INTO ShippingInfo (QuoteNumber)
SELECT a.QuoteNumber
FROM INSERTED as a
inner join inserted on ShippingInfo.ShippingIdentity = a.ShippingIdentity
update ShippingInfo set QuoteNumber = i.QuoteNumber
from ShippingInfo s
inner join inserted i on s.ShippingIdentity = i.ShippingIdentity
END

Praveen SreeramRank #134 · 16.8K reputationPosted Jun 9, 2016, 1:23 AM EDT
mike23 reputationPosted Jun 9, 2016, 7:24 AM EDT
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 9, 2016, 7:27 AM EDT
mike23 reputationPosted Jun 9, 2016, 8:05 AM EDT