Insert data to identity field

hi

I have 2 tables form 2 database .
I want to insert Id from database1.table1 to database2.table2 . this field is identity.

insert into  database2.table2  (
	   [Id]
      ,[Title]
     
      )

 select  [Id]
      ,[Title]

from databse1.table1 

my error is

Msg 544, Level 16, State 1, Line 3
Cannot insert explicit value for identity column in table 'table2' when IDENTITY_INSERT is set to OFF.

SET IDENTITY_INSERT table2 ON
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.