General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
>I issued the following:-
>
>insert into yearly1 select * from yearly
>
>I get the following message:-
>Msg 8101, Level 16, State 1, Line 1
>An explicit value for the identity column in table 'yearly1' can only be specified when a column list is used and IDENTITY_INSERT is ON.
>
>SET IDENTITY_INSERT yearly1 OFF
>insert into yearly1 select * from yearly
>
>The following message apper:-
>
>Msg 8101, Level 16, State 1, Line 3
>An explicit value for the identity column in table 'yearly1' can only be specified when a column list is used and IDENTITY_INSERT is ON.
Issam,
It seems the columns in the two tables do not match up. Your initial example showed that you were adding a new column to the table and making the new column an identity column. To use 'select *', SQL Server has to be able to match up all of the columns except the new identity column. It can match them up by name, sequence, or data type. Any ambiguity will cause the statement to fail.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only