How do I create a Linked Server from Sql Server to .dbf tables using Advantage ODBC or OLEDB?
How to c开发者_如何转开发reate a Linked Server from Sql Server to .dbf tables using Advantage ODBC or OLEDB?
You can use the OLE DB or ODBC driver. I have typically used the OLE DB driver.
I found it easiest to use the GUI to create it first, then have it generate the SQL commands.
But...
Here are some commands for one I was using to test recently.
EXEC master.dbo.sp_addlinkedserver @server = N'DBF_TEST', @srvproduct=N'Advantage', @provider=N'Advantage OLE DB Provider', @datasrc=N'c:\ads\dbftest', @provstr=N'servertype=ads_remote_server;tabletype=ads_cdx;'
/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'DBF_TEST',@useself=N'False',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
Then to select you have to use the OPENQUERY syntax
SELECT * FROM OPENQUERY(dbf_test, 'SELECT * FROM table1')
精彩评论