如何将数据从一个数据库获取到另一个数据库?
使用SQL 2000、SQL 2005
Old Database Name is – Sysdatabase
New Database Name is - Dual_Proone, Dual_Protwo
以上两个数据库中表名和列名不同,但值相同。
例如
Sysdatabase (Database Name)
Person (Table Name)
Column Names and values are
ID Date
001 23-02-2009
002 24-02-2009
So on...,
Company (Table Name)
Column Names and Values are
Code Name
1001 Micorsoft
1002 Dell
So on..,
Dual_Proone (Database Name)
T_person (Table Name)
Column Names and values are
EmpID, Cardeventdate
001 23-02-2009
002 24-02-2009
So on..,
Dual_Protwo (Database Name)
T_Company (Table Name)
Column Names and values are
CoCode, CoName
1001 Micorsoft
1002 Dell
So on..,
从上面的两个数据库来看,表和列不同,但值是相同的。
这里我想将dual_Proone和dual_protwo中的所有值获取到sysdatabase
我的软件正在与sysdatabase连接,但我需要dual_Proone、dual_Protwo数据库中的值。
我无法更改软件中的表名称和列名称,我想从dual_Proone 和dual_Protwo 中获取数据,
可以使用触发器吗?
请任何人帮助解决我的问题
需要查询帮助。
Using SQL 2000, SQL 2005
Old Database Name is – Sysdatabase
New Database Name is - Dual_Proone, Dual_Protwo
In the above two database table name and column name are different, but values are same.
For Example
Sysdatabase (Database Name)
Person (Table Name)
Column Names and values are
ID Date
001 23-02-2009
002 24-02-2009
So on…,
Company (Table Name)
Column Names and Values are
Code Name
1001 Micorsoft
1002 Dell
So on..,
Dual_Proone (Database Name)
T_person (Table Name)
Column Names and values are
EmpID, Cardeventdate
001 23-02-2009
002 24-02-2009
So on..,
Dual_Protwo (Database Name)
T_Company (Table Name)
Column Names and values are
CoCode, CoName
1001 Micorsoft
1002 Dell
So on..,
From the above two database, Table and column are different, but values are same.
Here I want to take all the values from dual_Proone and dual_protwo to sysdatabase
My software is connecting with sysdatabase, but I need the values from dual_Proone, dual_Protwo database.
I cannot able to change the Table name and Column names in the software, I want to take a data’s from dual_Proone and dual_Protwo
Is Possible by using trigger?
Please can any one help to solve my problem
Need query Help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Sql Server 2005 中,可以使用
ServerName.DatabaseName.dbo.Table 从不同的数据库中进行选择(如果是不同的服务器,则必须链接服务器。)
因此您可以 SELECT * FORM Dual_Proone.dbo.T_person 就好像该表位于同一个数据库中。
也看看这个。
In Sql Server 2005, it is possible to select from a different database useing
ServerName.DatabaseName.dbo.Table (if it is a different server, the server must be linked.)
So you can SELECT * FORM Dual_Proone.dbo.T_person as if the table was in the same database.
Have a look at this as well.