Jump to content

Recommended Posts

Posted

I am working on sql server.I need to write a stored procedure in one server to access data from a database in different server. is that possible???i tried,SELECT SNo, [Last Name], [First Name], MI, FROM servername.dbname.dbo.tablenamebut this seems to be not working.Thank you

Posted

Try this out:

SELECT SNo, [Last Name], [First Name], MI, FROM [servername\dbname].pubs.dbo.authors

where(server=servername, instance=dbname)

Posted

One thing I forgot to mention, you will need to add the server you want to connect to using the sp_addlinkedserver.Well, after further research on it, what you are wanting is linked servers. Here is a MSDN link that describes how to set it all up. You can even set it up so that you can access Access, Excel, or even a text file. Here is the link:http://msdn.microsoft.com/library/default....server_4uuq.aspHopefully that will be more informative than I could be.

Posted

I am glad I could help. I actually had to look this up myself. I knew it was possible since the DBA where I work had mentioned it before, but I never had actually done it myself. So I got to learn something new as well. :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...