把Sybase ASE的数据导入到SybaseIQ里
--首先必须创建ODBC 到ASE Server的连接--注意保证SybaseIQ上和ASE Server对应的数据库用户名和密码一致
--即:ASE 上用户是user1/sql123,那么IQ上也应该是user1/sql123
--在sybaseIQ 服务器上创建到ASE Server的连接
create server repa
class 'aseodbc'
using '192.168.5.111:5000/MYDB'
/**
说明:
repa 是在SybaseIQ里使用的逻辑服务器名称
class 是要使用的驱动
using '192.168.5.111:5000/MYDB' 是要使用的ASE Server主机名或IP,端口号和数据库名称
**/
--在ASE Server 上生成向SybaseIQ插入数据的SQL语句
--对于含有大对象字段类型的表,由于SybaseIQ默认不支持大对象,
--所有不往SybaseIQ里插入含有大对象的数据
--手动写这种类型的插入语句
select "insert into "+name+" location 'repa.MYDB' {select * from "+name+" };" from sysobjects where type='U' order by name asc
--删除SybaseIQ原有数据
truncate table T_Gather_table3_Data
truncate table T_Gather_table4_Data
truncate table T_Gather_table5_Data
truncate table T_Gather_table6_Data
truncate table T_Gather_table7_Data
.....
--导入到IQ的脚本:
insert into T_AreaNotifi location 'repa.MYDB' {select * from T_AreaNotifi };
--表T_Document_Document含有text和image字段类型
insert into T_Document_Document (
archiveid,
archiveno,
archivename,
archivetype,
archiveclass,
orgsendingarchive,
orgreceivingarchive,
archivespecification,
sendingstatus,
receivingstatus,
receivuploadstatus,
creatingname,
creatingdate,
updatingname,
updateingdate,
filetype
)
location 'repa.MYDB' {select
archiveid,
archiveno,
archivename,
archivetype,
archiveclass,
orgsendingarchive,
orgreceivingarchive,
archivespecification,
sendingstatus,
receivingstatus,
receivuploadstatus,
creatingname,
creatingdate,
updatingname,
updateingdate,
filetype
from T_Document_Document
};
页:
[1]