Rgoal


I want to be able to access a table from another server for example

using a stored procedure:

I am in server A

I want to do a select in a table (dbo.test) that is located on server b. so how can i connect to server b using windows

authentication then access the table dbo.test

thanks




Re: How To Connect From SQL Server Database To Another SQL Server Database

DaleJ


You might want to do a search on this forum, and look at BOL, for topics relating to LINKED SERVERS.







Re: How To Connect From SQL Server Database To Another SQL Server Database

Suprotim Agarwal

Hi,

Follow these steps:

1. Link the Server B to Server A. Use the sp_addlinkedserver

2. Try this query then

select * from [ServerB].[dbname].[dbo].[test]

HTH,
Suprotim Agarwal

-----
http://www.dotnetcurry.com
-----








Re: How To Connect From SQL Server Database To Another SQL Server Database

Barry Andrew

Just to add that this is the link that you are looking for; sp_addlinkedserver





Re: How To Connect From SQL Server Database To Another SQL Server Database

Arnie Rowland

As well as linking the servers using sp_addlinkedserver, ALL users accounts is ServerA that need to access the data in ServerB MUST have logins in ServerB, as well as permissions to access the database and table.

This thread might be useful.

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=2318301&SiteID=1






Re: How To Connect From SQL Server Database To Another SQL Server Database

Rgoal

Thanks Guys.

This is what i did:

select * from OPENROWSET('MSDASQL','DRIVER={SQL Server};SERVER=SeverA',projectserver.dbo._Test))