Link to home
Start Free TrialLog in
Avatar of romeiovasu
romeiovasu

asked on

SQL 2005 connectiion link

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.
Avatar of imitchie
imitchie
Flag of New Zealand image

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
Avatar of romeiovasu
romeiovasu

ASKER

i am getting this error The OLE DB provider "MSDASQL" has not been registered.
ASKER CERTIFIED SOLUTION
Avatar of imitchie
imitchie
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial