如何创建代理表?

反对宣传员 2004-07-15 12:37:04
欲在A服务的A_D数据库中查询
B服务的B_D数据库的T表数据,已在A服务中建立远程数据库B。
...全文
129 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wgzymzx 2005-08-04
  • 打赏
  • 举报
回复
用:Sybase central中代理表中的指导一步一步做了,很简单的。只要选择正确的远程服务器、数据库、表对象就可以了。
或:这是一个代理表的DDL,仔细研究一下吧。
print 't_city'
SETUSER 'dbo'
go

sp_addobjectdef t_city, 'DkhDbServer.VISDB.dbo.t_city', 'table'
create existing table dbo.t_city (
city_level tinyint null,
city_id numeric(18, 0) not null,
city_code varchar(255) null,
city_name char(20) null,
sts tinyint null,
sts_date datetime null,
local_city smallint null,
city_latn varchar(4) null
)
lock allpages
on 'default'
go

print 't_city_10400067362'
create unique nonclustered index t_city_10400067362
on dbo.t_city (city_id)
on 'default'
go

print 't_city_idx_all'
create nonclustered index t_city_idx_all
on dbo.t_city (city_code, city_level, sts)
on 'default'
go

print 't_city_idx_citycode'
create nonclustered index t_city_idx_citycode
on dbo.t_city (city_code)
on 'default'
go

SETUSER
go
linyang80 2005-08-04
  • 打赏
  • 举报
回复
其实也不是很麻烦,只要执行两个系统存储过程就可以了
建立远程服务器
exec sp_addserver "逻辑名称", "ASEnterprise", "服务器名称"
定义代理表
sp_addobjectdef SB_TDZZ1_PROXY,"wssbserver.AHWS_TEST..SB_TDZZ1","table"
这个不用解释了
建表
CREATE EXISTING TABLE AHWS_DL_NSRDLRZ_PROXY,结构与物理表结构相同
这样就可以了
whoknow 2004-07-16
  • 打赏
  • 举报
回复
这个问题比较难,关键是没用过.帮你up
jnhnsh 2004-07-16
  • 打赏
  • 举报
回复
在www.chinaunix.net的sybase论坛中有详细的介绍。
其他高手的帖子就不好意思拿来Copy啦。

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧