我有两个Database,DB1和DB2。如何传输DB1的数据 SQL Server 2000中DB2的特定表?
答案 0 :(得分:1)
答案 1 :(得分:1)
如果您需要通过代码(.NET标记)执行此操作,那么SqlBulkCopy
是您的朋友 - 当与源上的ExecuteReader
混合时。 Like so:
using (SqlConnection connSource = new SqlConnection(csSource)) // source db
using (SqlCommand cmd = connSource.CreateCommand())
using (SqlBulkCopy bcp = new SqlBulkCopy(csDest)) { // destination db
bcp.DestinationTableName = "SomeTable"; // destination table
cmd.CommandText = "SELECT * FROM [Foo]"; // source table
cmd.CommandType = CommandType.Text;
connSource.Open();
using(SqlDataReader reader = cmd.ExecuteReader()) {
bcp.WriteToServer(reader);
}
}
答案 2 :(得分:0)
右键单击DB2和Tasks->导入将启动DTS向导。这很简单。
答案 3 :(得分:0)
关于此转移的一些其他背景将是有用的。例如,这是一次性转移,常规转移,您想要为DB1中的每个交易维护的东西。
我将假设这是一次性或定期出现,因此,我建议 SQL Server 2000中的数据转换服务(DTS):