CREATE TRIGGER AfterInserttb1
ON tb1
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
--if columns do not match than
--use variable to insert the data
INSERT INTO tb2
SELECT * FROM inserted
--columns dont match
DECLARE @Col1 VARCHAR(10)
DECLARE @Col2 VARCHAR(10)
DECLARE @Col3 VARCHAR(10)
SELECT @Col1=Col1,
@Col2=Col2,
@Col3=Col3
FROM inserted
INSERT INTO @tb2(Col1,Col2,Col3)
SELECT @Col1,@Col2,@Col3
END
GO
this is a simple example