Popular Posts
-
This blog is to let you know how to use the SQL import wizard. It is very interesting. The most important thing to remember is that you ca...
-
The object of copying code is to save time. However, I have discovered by sad and repeated experience that copying code more often than not...
-
View the complete solution at https://github.com/adamvaul/React-Server-Side-Web-Forms . I love ReactJS.Net. It is a framework for manag...
-
Dear Heavenly father, thank you for the impressions though hast given me this day. I am grateful for Jesus Christ who died for me. Not the...
-
Adam, Adam, thou art perfect before me. Thou shalt not lose thy children nor shalt thou see the bars of prison, jail, or cell ever again. ...
-
The ToNumbers method basically takes a string and turns it into only numbers using the fact that numbers are characters between 47 and 58....
-
Tonight I attended a conference hosted by The Church of Jesus Christ of Latter-day Saints. It's topic was the protection of the institu...
-
Agency is the most beautiful part of the gospel of Jesus Christ. Because of it, as Joseph Smith said we are free. Parents of children want...
-
Excel likes to write numbers into scientific notation. This raises a problem if you are trying to message data into a database from an exce...
-
Background Every Microsoft SQL Server database, there is a folder called Server Objects. Within that folder there is a folder called "...
Wednesday, February 2, 2011
Connecting Two Remote Databases in a single SQL Query
Background
Every Microsoft SQL Server database, there is a folder called Server Objects. Within that folder there is a folder called "Linked Servers". If you right click on that folder and hit New Linked Server, it will open up a new linked server wizard.
New Linked Server Wizard
By following the steps there, you can setup a new linked server.
First, type in the name or IP address of the server where it says "Linked server". For example: "1.0.9.46".
For a remote SQL database choose SQL Server as the server type. Then select the security page from the left, and enter the login credentials under the "Be made using this security context" option: Enter the username where it says remote login, and the password below where it says "With password."
Creating a Query using the Linked server.
Once your linked server is setup, you can execute a query like the following:
SELECT *
FROM
[1.0.9.46].DatabaseName.dbo.tableName t
JOIN users ON user.ID = t.userID;
Enjoy!!!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment