Here is what I should work:
IF OBJECT_ID('T1') IS NOT NULL
DROP TABLE T1;
GO
CREATE TABLE T1 (id int PRIMARY KEY, timestamp);
GO
INSERT INTO T1(id) VALUES (1);
GO
declare @v as table ([timestamp] varbinary)
INSERT INTO T1(id)
OUTPUT inserted.[timestamp] into @v
VALUES (10);
select * from @v
One thing you need to understand is the timestamp field, which cannot be manually filled. Therefore, you should use a different type in your output table. ANd BTW timestamp is out of date, I would not use it in the new development at all. Use rowversion instead. And the timestamp does not mean that it will be a date for those who think it should be similar to ANSII Standard, IN SQL Server is not a date or a convertible date.
Hlgem source
share