--删除服务器连接
-- EXEC sp_dropserver 'MYSQLODBC','droplogins'
--创建 MYSQLODBC 连接名的服务器连接
EXEC sp_addlinkedserver @server = N'MYSQLODBC', @srvproduct=N'mysql', @provider=N'MSDASQL', @datasrc=N'MYSQLODBC'
GO
EXEC sp_addlinkedsrvlogin 'MYSQLODBC','false',null,'root','****'
GO
--创建视图
CREATE VIEW v_userinfo
AS
SELECT * FROM OPENQUERY (MYSQLODBC,'select * from userinfo' )
--SELECT 视图记录
SELECT * FROM v_userinfo
--删除服务器连接
-- exec sp_dropserver 'ss','droplogins'
--创建 ss 连接名的服务器连接
EXEC sp_addlinkedserver @server = N'ss', @srvproduct=N'mysql', @provider=N'MSDASQL', @datasrc=N'ss'
GO
EXEC sp_addlinkedsrvlogin 'ss','false',null,'root','5658'
GO
--创建视图
CREATE VIEW v_supe_members
AS
SELECT * FROM OPENQUERY (ss,'select * from supe_members' )
GO
--创建视图
CREATE VIEW v_supe_spaceblogs
AS
SELECT * FROM OPENQUERY (ss,'select * from supe_spaceblogs' )
GO
--删除视图
DROP VIEW v_supe_members
GO
SELECT * FROM v_supe_members
SELECT * FROM v_supe_spaceblogs
SELECT * FROM OPENQUERY (ss,'select uid,groupid,password,timeformat from supe_members' )
GO
update v_supe_members set username = 'awwwwwwwwwwwww' where uid = 1271348
select IDENT_CURRENT('ad_user')
select SCOPE_IDENTITY()
select len('访问接口')