#mysql 导入sqlserver数据库
EXEC master.dbo.sp_addlinkedserver
@server = N'sjkxb00',
@srvproduct=N'MySQL',
@provider=N'MSDASQL',
@provstr=N'DRIVER={MySQL ODBC 5.3 Unicode Driver}; SERVER=localhost; _DATABASE=tigerdb; USER=root; PASSWORD=123456; OPTION=3'
--数据导入到 loreal 数据库中
--cast(null as bigint) as Id
select identity(bigint,1,1) as Id,* into loreal.dbo.Comments from openquery(sjkxb00, 'SELECT * FROM loreal.t_comment_5927833634809674453')
--数据导入到 wmm 数据库中
select
-- top 5 *
identity(bigint,1,1) as Id,* into wmn.dbo.t_lable_groupwmm
from openquery(sjkxb00, 'SELECT * FROM wmn.t_lable_groupwmn')
select
-- top 5 *
identity(bigint,1,1) as Id,* into wmn.dbo.w_user_info_wmm
from openquery(sjkxb00, 'SELECT * FROM wmn.w_user_info_wmn')
--数据导入到 bbqne 数据库中--未插入
select * from openquery(sjkxb00, 'SELECT * FROM bbqne.t_dpt_203')
select top 10 * from openquery(sjkxb00, 'SELECT * FROM bbqne.t_lable_group203')--要把mysql中char()修改为varchar()
select * from openquery(sjkxb00, 'SELECT * FROM bbqne.w_user_info_203')