I wish to insert records from one table into another in the same database.
Both tables have the same structure.
I am using
use mydatabase
insert into Table2
select * from Table1
but I receive the error message "Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column."
I then tried to use the column list method
USE [mydatabase]
GO
INSERT INTO [dbo].[Table2]
([Field1]
,[Field2]
,[Field3]
)
VALUES
(dbo.Table1.Field1
,dbo.Table1.Field2
,dbo.Table1.Field3
)
GO
but this resulted in a list of error messages such as:
"The multi-part identifier "dbo.Table2.Field1" could not be bound."
Can anyone help me update this table?
First try this:
Change to:
INSERT INTO [dbo].[Table2]
([Field1]
,[Field2]
,[Field3]
)
SELECT Field1, Field2, Field3
FROM dbo.Table1
GO
Otherwise remove the field that has the timestamp and try again.
LVBarnes