Error in running SQL Server script I copied oldDatabase as newDatabase. Modified newDatabase's schema.
Meanwhile, oldDatabase's data are processing and updating.  

I want to copy oldDatabase's data to newDatabase.  

What I have done is:


Clean the data of newDatabase   
Generate data only script of oldDatabase   
Run this script in newDatabase.


And I got a lot of error messages like:

Cannot insert explicit value for identity column in table 'MyTableName' when   
IDENTITY_INSERT is set to OFF.

Invalid column name 'MyColumnName'.

Violation of PRIMARY KEY constraint 'PK_MyTableName'. Cannot insert duplicate  
key in object 'dbo.MyTableName'.


Some tables and rows data are affected. But, tables with above error are not affected. How can I fix it? Is there a best way to make this stuff?

PS

I run my script using this command ,

sqlcmd -S myServerName -U userName -P passowrd -i PathOfMyScriptFile
What your script is doing is explicitly attempting to insert data into an IDENTITY column. You need to do one of two things:  Either set IDENTITY_INSERT to ON for that table prior to the insert, or rework the INSERT statement so that it doesn't have the IDENTITY column specified with a value.