I have 2 databases on SQL (identical). I want a table from one database to be copied to the other databas开发者_如何转开发e. They are both the same name and the original table can be overwritten.
DELETE FROM `target_database`.`table_name`
INSERT INTO `target_database`.`table_name` SELECT * FROM `source_database`.`table_name`
If you want the tables in sync continuously, you can use Transactional Replication.It will keep on copying the data from one table one db to another table of other DB.
Refer for further setup details over here:
http://www.databasejournal.com/features/mssql/article.php/1438201/Setting-Up-Transactional-Replication-A-Step-by-step-Guide.htm
Assuming no computed columns, Identity columns or FK constraints something like the following should work.
BEGIN TRAN
DELETE FROM SixthSenseUsers.dbo.college_survey_questions
INSERT INTO SixthSenseUsers.dbo.college_survey_questions
SELECT * FROM test.dbo.college_survey_questions
COMMIT
精彩评论