|
查看: 1279|回复: 3
|
MSSQL 2000
[复制链接]
|
|
|
如何把两个 table 的数据弄成一样?
例子:
1. TESTING_1 instance contains Testing DB, Testing DB contains table: Test_1.
2. TESTING_2 instance contains Testing DB, Testing DB contains table: Test_1.
我要怎样才能把 table Test_1(TESTING_1 instance) 的 数据 (data) 抄去 TESTING_2 instance -> table Test_1 呢?
每当有新的 update 在 table Test_1(TESTING_1 instance) 时,它会自动反映在 table Test_1(TESTING_2 instance)  |
|
|
|
|
|
|
|
|
|
|
发表于 10-3-2008 04:57 PM
|
显示全部楼层
可以用TRIGGER.
当TRIGGER碰到insert, update, delete 的EVENT就对抄.
自己看看怎样写TRIGGER, MSSQL的HELP FILE里面有教..
如果你的TABLE2只是为了拿来VIEW..而已..那么可以建立一个VIEWS. VIEWS TABLE 不能EDIT的..只能看...不过通常是用来VIEW其他DB的TABLE的.
再不然..你的QUERY可以这样
select * from instance1(nolock)
NOLOCK可以让你QUERY出你要的TABLE. 但又不影响其他PROCESS更改这TABLE. |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 10-3-2008 05:09 PM
|
显示全部楼层
如果我的 DB 有一百个 tables,那么我就要弄一百个 triggers 吗?  |
|
|
|
|
|
|
|
|
|
|
发表于 10-3-2008 08:37 PM
|
显示全部楼层
|
还有一个叫replication 的。。但我不清楚它可以复制同DB的吗。。因为我只用来复制到远端的另一架server |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|