maelstorm Posted November 16, 2005 Posted November 16, 2005 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
Kcarson Posted November 16, 2005 Posted November 16, 2005 Try this out: SELECT SNo, [Last Name], [First Name], MI, FROM [servername\dbname].pubs.dbo.authors where(server=servername, instance=dbname)
Kcarson Posted November 16, 2005 Posted November 16, 2005 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.
maelstorm Posted November 16, 2005 Author Posted November 16, 2005 Hey Carson,Finally got it rightThanks a lot man, you are awesome.........
Kcarson Posted November 17, 2005 Posted November 17, 2005 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now