日期:2014-05-17 浏览次数:20378 次
insert into OPENROWSET( 'MSDASQL', 'DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost; PORT=3306;DATABASE=wpf; USER=root;PASSWORD=w001; STMT=set names gb2312; OPTION=2049','select * from tAbc;' ) select 0,'admin','admin','0','test1','2013-08-05 15:00:26','1','0','0','','','','0','0'
alter trigger mysqlTest_1 on [t_1mysql]
for insert,update
as
declare @var1 varchar(max),@var2 varchar(max),@txt nvarchar(max)
select @var1=F1 from inserted
set @txt=
'insert into OPENROWSET(
''MSDASQL'',
''DRIVER={MySQL ODBC 5.1 Driver};
SERVER=localhost;
PORT=3306;DATABASE=wpf;
USER=root;PASSWORD=w001;
STMT=set names gb2312;
OPTION=2049'',''select * from tAbc;''
)
select 0,''admin'',''admin'',''0'','''+isnull(@var1,'')+''',''2013-08-05 15:00:26'',''1'',''0'',''0'','''','''','''',''0'',''0'''
exec sp_executesql @txt
insert into t_1mysql
values('test1','abc')