Update 和 Select 结合使用,导入外部服务器的数据

来源:互联网 发布:淘宝客链接 编辑:程序博客网 时间:2024/05/20 19:32

/* -- 首先启用 Ad Hoc Distributed Queries :--
exec sp_configure 'show advanced options',1
reconfigure

exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

GO
*/



Update a  
Set a.Uid = b.Uid,   a.IsRent=b.isRent

From  louRoom as a, openDataSource('SqlOledb', 'server=192.168.1.0;  uid=sa;  pwd=123456;').cyyDB.dbo.louRoomasb

Where a.id =  b.id



/* -- 使用完成后,关闭Ad Hoc Distributed Queries:--
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure

exec sp_configure 'show advanced options',0
reconfigure

GO
*/


---- 读取Excel格式文件的方法----

Select   * 
From  OpenDataSource
(
'Microsoft.Jet.OLEDB.4.0',  
'Excel 8.0; IMEX=1; Database=E:\test.xls'  

)...[标签1$]