SQL Server Copying tables from one database to another

前端 未结 7 1185
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-20 16:56

I have two databases, one is called Natalie_playground and one is called LiveDB. Since I want to practice insert, update things, I want to copy som

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-20 17:45

    try this

    USE TargetDatabase
    GO
    
    INSERT INTO dbo.TargetTable(field1, field2, field3)
    SELECT field1, field2, field3
    FROM SourceDatabase.dbo.SourceTable
    WHERE (some condition)
    

提交回复
热议问题