[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 954
  • Last Modified:

Link SQL Server directly to external ODBC datasource

I am working to develop a procedure to pull data from an external ODBC datasource into a SQL Server 2008 R2 database.  I'm currently doing this via Access, since I started using Access with the external ODBC source and now have the need to move the data to SQL Server instead of Access.

However, my experience with SQL Server is somewhat limited, and I don't know how to link this external datasource directly to SQL Server so that I can bypass Access entirely for this process.

My eventual goal is to run a query that appends new data from the ODBC data source about once every hour.  I assume that this would be done with SSIS, and will probably be posting a question about that soon as well.

The machine SQL Server is running on contains the driver for the datasource and the connection string I'm currently using to connect Access to the ODBC source Looks like:

ODBC;DSN=CygNet;SDSN=Default;HST=C:\xxx\yyy\ODBC\cfg\oadm.ini;PRT=abcdefg
0
Dale Fye
Asked:
Dale Fye
  • 3
  • 2
1 Solution
 
chaauCommented:
It is very easy. Open SSMS. Navigate to Server Objects->Linked Servers. Right click and select New Linked Server. Create the new server as per the image:
Linked ServerWhen the new server is created you can run the query like this:
SELECT * FROM OPENQUERY(CYGNET, 'Select * from tableInAccessDatabase')

Open in new window

Or using the following notation:
SELECT * FROM CYGNET...tableInAccessDatabase

Open in new window

(Please note that you need to use ... in the second example)
0
 
chaauCommented:
Just wanted to add. You can use sp_addlinkedserver to add the linked server via TSQL, like this:
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver 
    @server = N'GYGNET', 
    @provider= N'MSDASQL',
    @srvproduct=N'Access', 
    @datasrc=N'CygNet';
GO

Open in new window

0
 
Dale FyeAuthor Commented:
I think you misunderstood my intent.  I would like to take Access out of the mix entirely and link the tables in the Cygnet datasource directly to SQL Server.
0
 
chaauCommented:
In this case you need to import the tables to your SQL database
0
 
Dale FyeAuthor Commented:
Although this did not resolve the issue of the external ODBC connection, it did provide me with an answer to another issue, which is liking directly to an Access database.

Thanks for your help.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now