分类: Mysql/postgreSQL
2012-04-06 14:33:16
1、因为是跨库查询产生的记录,所以在SQL SERVER客户端执行如下SQL:
insert into ReportServerTempDB.dbo.QingFeng select t.BindingUserID,a.* from OPENDATASOURCE( 'SQLOLEDB', 'Data Source=192.168.1.55;User ID=sa;Password=123456^%$#@!' ).agg_data.dbo.dim_iptv_xunlei_client a,TCL_Portal_New.dbo.TCL_Client_Device_Detail t where '0x'+a.RawValue=t.IDKeytoken;2、从临时表中导出平面文件
EXEC master..xp_cmdshell 'BCP "select * from ReportServerTempDB.dbo.QingFeng" queryout d:\folder\currency.txt -c -T -C 65001 -t ","'3、在MYSQL服务器端进行导入
load data local infile '/opt/expdb/currency.txt' into table exptable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (BindingUserId,id,rawvalue,FirstVisitDate,LatestVisitDate,Type,Version);