首先设置SQL2005服务组件

EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
GO

再通过SQL语句来查询导入数据

insert into sa_tree select * from OPENROWSET('SQLOLEDB', 'SERVER=172.27.27.126;uid=sa;pwd=jibojibo;Database=snsDB','select * from sa_tree') as a

posted on 2013-01-17 15:05  风浪  阅读(299)  评论(0编辑  收藏  举报