Step: 1. back up the source database and restore the backup file to the target database on the other server. 2. export all the foreign keys in the source database and views (starting with dta_mv _) generated by the optimization consultant as before. SQL statement. SQL; 3. run before on the target database. SQL; 4. perform the copy operation. 5.
Step: 1. back up the source database and restore the backup file to the target database on the other server. 2. export all the foreign keys in the source database and views (starting with 'dta_mv _ ') generated by the optimization consultant as before. SQL statement. SQL; 3. run before on the target database. SQL; 4. perform the copy operation. 5.
Steps:
1. First back up the source database, and restore the backup file to the target database on another machine;
2. export all the foreign keys in the source database and views (starting with 'dta _ mv _ ') generated by the optimization consultant as before. SQL statement. SQL;
3. Execute before. SQL on the target database;
4. Perform the copy operation;
5. Execute after. SQL on the target database;
Note:
1. All Tables in the two databases must have the same structure, and even the column sequence cannot be changed. Otherwise, SqlBulkCopy does not recognize it!
2. SqlBulkCopy should be created as follows: SqlBulkCopy bulkCopy = new SqlBulkCopy (outerConn, SqlBulkCopyOptions. KeepIdentity | SqlBulkCopyOptions. KeepNulls, null). AddTimeout ();
If you do not press this button, the ID column cannot be inserted as the original one. For more information, see sqlbulkcopy batch insert data.