Solved

SQL 2005 connectiion link

Posted on 2007-11-16
3
141 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 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