CREATE TABLE HistoryTable (ID INT, NAME VARCHAR(100))
INSERT TestTable (ID, NAME)
OUTPUT Inserted.ID, Inserted.NAME INTO HistoryTable
VALUES (1,'Value1')
Select * from TestTable
Select * from HistoryTable
We have used OUTPUT clause to achieve above result without using trigger.
What is OUTPUT clause
OUTPUT clause returns a copy of the data that you have inserted into or deleted from your tables.
You can return that data to a table variable, a temporary or permanent table.
-------------------------------------------------------------------------------
Additionally want to know this:
Difference between LEN and Data Length in SQL
Count Columns in a table