且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将表从一个数据库复制到另一个数据库

更新时间:2021-12-26 22:09:33

u可以将选定的数据/表/记录插入到另一个数据库的表中,请尝试以下示例:

插入TargetDb.dbo.TargetTable(Col1,col2,...)
选择ColId,SomeCol1,SomeCol2 ...
从SourceTable
u can insert selected data/table/record to another database''s table try the following sample:

insert into TargetDb.dbo.TargetTable(Col1,col2,...)
Select ColId,SomeCol1,SomeCol2...
From SourceTable


insert into TestDestination.dbo.Employee (Column1, Column2, ...)
select  (Column1, Column2, ...) from TestSource.dbo.Employee



这将在TestDestination数据库中创建一个新表



This will create a new table in TestDestination database

select  (Column1, Column2, ...) into Employee  from TestSource.dbo.Employee