- Aug 26, 2004
- 14,685
- 1
- 76
UPDATE:i fail at error comprehension, mixed up timestamp and datetime datatypes lol
I'm archiving data from a single table to a 2nd DB. I am unable to directly INSERT the timestamp values because SQL Server wants to generate them itself.
Is there any way to force SQL Server to allow me to insert the values that I pull from the main table? There are a few datetime columns that I need to stay the same, not get updated with the current server time.
INSERT INTO ARCHIVEDB.dbo.TABLE
SELECT * FROM TABLE WHERE Column = @VariableSetElsewhere
DELETE FROM TABLE WHERE Column = @VariableSetElseWhere
That is the basic syntax of my statement.
All the research I've done suggests setting a default value to override, which would be fine if i were inserting a small number of rows...but this script will move 20K rows at a time, it's simply not feasible to specify a default value for each row that I need to insert.
I'm archiving data from a single table to a 2nd DB. I am unable to directly INSERT the timestamp values because SQL Server wants to generate them itself.
Is there any way to force SQL Server to allow me to insert the values that I pull from the main table? There are a few datetime columns that I need to stay the same, not get updated with the current server time.
INSERT INTO ARCHIVEDB.dbo.TABLE
SELECT * FROM TABLE WHERE Column = @VariableSetElsewhere
DELETE FROM TABLE WHERE Column = @VariableSetElseWhere
That is the basic syntax of my statement.
All the research I've done suggests setting a default value to override, which would be fine if i were inserting a small number of rows...but this script will move 20K rows at a time, it's simply not feasible to specify a default value for each row that I need to insert.
Last edited:
