WoundedEgo
WoundedEgo

Reputation: 29

How do I create a Linked Server from Sql Server to .dbf tables using Advantage ODBC or OLEDB?

How to create a Linked Server from Sql Server to .dbf tables using Advantage ODBC or OLEDB?

Upvotes: 2

Views: 5946

Answers (1)

Edgar
Edgar

Reputation: 943

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')

Upvotes: 6

Related Questions