I am looking for the simplest way in SQL to copy the contents of one table, to an identifcally structured table in another database (on the same server). The tables have an Identify field.
In Query Analyser, I select the destination database, then when I use the syntax:
INSERT INTO tblCompany
SELECT *
FROM PDAdmin.dbo.tblCompany
I get the diagnostic:
Server: Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'tblCompany' can only be specified when a column list is used and IDENTITY_INSERT is ON.
I understand all of this; is there a simple way of getting round this without having to explicitly include all fields in the SQL; also, do I have any control of how the indentity field values are transferred (eg. I might want to duplicate them, or alternatively, re-initialise them).
TIA,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
In Query Analyser, I select the destination database, then when I use the syntax:
INSERT INTO tblCompany
SELECT *
FROM PDAdmin.dbo.tblCompany
I get the diagnostic:
Server: Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'tblCompany' can only be specified when a column list is used and IDENTITY_INSERT is ON.
I understand all of this; is there a simple way of getting round this without having to explicitly include all fields in the SQL; also, do I have any control of how the indentity field values are transferred (eg. I might want to duplicate them, or alternatively, re-initialise them).
TIA,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)