任何人都可以解释下面代码会做什么 [英] Can any one explain me what below code will do

查看:87
本文介绍了任何人都可以解释下面代码会做什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SET NOCOUNT ON;

Exec sp_configure 'show advanced options', 1;
RECONFIGURE;
GO

Exec sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

SELECT ID,FirstName,Surname
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=C:\AddressBook.mdb')...[tblContacts]

--SELECT [Field1],[Field2],[Field3],[Field4]
--FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=Location:\Filename.mdb')
...[TableName]

Exec sp_configure 'Ad Hoc Distributed Queries', 0;
RECONFIGURE;
GO

Exec sp_configure 'show advanced options', 0
RECONFIGURE;
GO

推荐答案

使用上述代码..我们可以从AddressBook.mdb(MS-Access File)访问表'tblContacts'的内容存在于C盘...



你可以尝试这个代码...

首先在c盘中创建一个ms访问文件,并将其命名为AddressBook,并创建一个表'tblContacts',其中包含列ID,名字,姓氏......并提供一些示例数据...



通过使用上面的代码你可以在SqlServer中查看tblContacts的内容....



阅读这些: OPENDATASOURCe [ ^ ]

Ad Hoc Quieries [ ^ ]
By Using the above Code... we can access the Contents Of the table 'tblContacts' from AddressBook.mdb (MS-Access File) Present in C Drive...

U can try this Code...
First Create a ms access File in c drive and name it as AddressBook and create a table 'tblContacts' with columns ID,Firstname,Surname.. and provide some sample data...

By using the above code u can view the contents of tblContacts in SqlServer....

Read these: OPENDATASOURCe[^]
Ad Hoc Quieries[^]


一切都在MSDN -TechNet网站上解释:

sp_configure [ ^ ]

OPENDATASOURCE [ ^ ]
Everything is explained on MSDN -TechNet site:
sp_configure[^]
OPENDATASOURCE[^]


这篇关于任何人都可以解释下面代码会做什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆