I want to create a trigger on a SQL Server table.
Table has 8 columns. One of them is email. i.e. [email protected]
What I want is: when a new row is inserted into the table, the trigger should update my ISP column with msn.com
CREATE TRIGGER TIGUPDATEISP ON SUBS
FOR INSERT
AS
UPDATE SUBS
SET ISP = SELECT RIGHT(EMAIL, LEN(EMAIL) - CHARINDEX('@', EMAIL) FROM INSERTED)
This is updating all my isp with the last value. However, I wanted to update one as per insert.