Solved

SQL 2005 connectiion link

Posted on 2007-11-16
3
140 Views
Last Modified: 2012-05-05
i am using sql server 2005. i have another database which is on the other network. and i have odbc connection settings if i want to link to that database in my sql how can i link that database and start writing queries.
0
Comment
Question by:romeiovasu
  • 2
3 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20303815
this can get you started: (let's say the servers are svr1 and svr2)
on svr1
sp_addlinkedserver 'svr2'
then to run a query
    select top 10 * from svr2.database.dbo.tablename
you can even join to local tables, like
    select top 10 * from svr2.database.dbo.tablename inner join dbo.localtable on ...

check books online for sp_addlinkedserver. the example above will use the current login (to svr1) to authenticate with svr2. so if you're on a domain and using windows authentication, shouldn't be a problem
0
 

Author Comment

by:romeiovasu
ID: 20304462
i am getting this error The OLE DB provider "MSDASQL" has not been registered.
0
 
LVL 25

Accepted Solution

by:
imitchie earned 500 total points
ID: 20324942
http://msdn2.microsoft.com/en-us/library/aa259589(SQL.80).aspx

does the other server have an instance name? the following adds it to be referred locally as myserver, but is actually connecting to server\instance1

EXEC sp_addlinkedserver  
   @server='myserver',
   @srvproduct='',
   @provider='SQLNCLI',
   @datasrc='server\instance1'

usage:
 select top 10 * from myserver.database.dbo.table
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
reading data from replication SQL database 7 87
Getting the 3 middle digits 4 35
How to disable/enable multiple sql jobs in efficient way 11 99
Help with simplifying SQL 6 47
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now