INSERT INTO 表 SELECT * FROM 表 IN 'xxx.mdb' 实行导入,由于xxx.mdb是要密码的,提示密码错,正确的应如

  • 主题发起人 主题发起人 mynlxx
  • 开始时间 开始时间
M

mynlxx

Unregistered / Unconfirmed
GUEST, unregistred user!
INSERT INTO 表 SELECT * FROM 表 IN 'xxx.mdb' 实行导入,由于xxx.mdb是要密码的,提示密码错,正确的应如何写?(100分)<br />INSERT INTO 表 SELECT * FROM 表 IN 'xxx.mdb' 实行导入,
由于xxx.mdb是要密码的,提示密码错,正确的应如何写?
 
参考一下这个,没有实验
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'f:/pic.mdb';'Admin';''; ///这里输入光盘的路径
pic) where id=yuangong.id
 
看不太懂意思,不知如何代入参数。给个例子吧:
假设:我已经用一个ADOQuery控件连上一个数据库,要导入xxx.mdb的'123'表,(两个库的表
名和表结构一样),密码为:321,应该如何定这个SQL语句!
 
楼上的想法是对的,我也没试,呵呵
 
参数我代进出总是语法错,能代一个例子给我看看吗?
 
我也是在别的地方看的,随手摘下来了,没有实现。
刚才用了一下,没成,关键是搞懂OPENROWSET是做什么的。
 
看样子这样实现比较麻烦了咯。哎。各位是否有别的方法来导入数据库呢?用ADOQuery.
 
Distributed Query Architecture
Microsoft&amp;reg; SQL Server&amp;#8482; version 7.0 supports two methods for referencing heterogeneous OLE DB data sources in Transact-SQL statements:

Linked server names
The system stored procedures sp_addlinkedsrv and sp_addlinkedserverlogin are used to give a server name to an OLE DB data source. Objects in these linked servers can be referenced in Transact-SQL statements using four-part names. For example, if a linked server name of DeptSQLSrvr is defined against another copy of SQL Server 7.0, the following statement references a table on that server:

SELECT * FROM DeptSQLSrvr.Northwind.dbo.Employees



The linked server name can also be specified in an OPENQUERY statement to open a rowset from the OLE DB data source. This rowset can then be referenced like a table in Transact-SQL statements.

Ad hoc connector names
For infrequent references to a data source, the OPENROWSET function is specified with the information needed to connect to the linked server. The rowset can then be referenced the same way a table is referenced in Transact-SQL statements:

SELECT *

FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'c:/MSOffice/Access/Samples/Northwind.mdb';'Admin';'';

Employees)



SQL Server 7.0 uses OLE DB to communicate between the relational engine and the storage engine. The relational engine breaks down each Transact-SQL statement into a series of operations on simple OLE DB rowsets opened by the storage engine from the base tables. This means the relational engine can also open simple OLE DB rowsets on any OLE DB data source.



The relational engine uses the OLE DB API to open the rowsets on linked servers, to fetch the rows, and to manage transactions.

For each OLE DB data source accessed as a linked server, an OLE DB provider must be present on the server running SQL Server. The set of Transact-SQL operations that can be used against a specific OLE DB data source depends on the capabilities of the OLE DB provider. For more information, see the OLE DB Provider Reference for Distributed Queries.

Whenever possible, SQL Server pushes relational operations such as joins, restrictions, projections, sorts, and group by operations to the OLE DB data source. SQL Server does not default to scanning the base table into SQL Server and performing the relational operations itself.

 
再帮帮忙呀!
 
接受答案了.
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部