I would like to know how to make a select query in vb.net, with joins between tables contained in databases of two different instances of sql server.
thanks.
Related
I have a situation where I need to extract tables from one SQL database into another SQL database. There are about 100+ tables.
I would like to create a parameterized script for the SELECT and FROM tables so that the one script can be used to loop through all the tables.
Is this possible? I would really appreciate any assistance.
I have two tables in different databases with different schema, how can I compare them both?
Let's say I have the DB1 with the table history.Table1 and another DB2 with the same table but in a different schema, backup.Table1.
Now I need to compare what's different besides the schema name obviously.
Try SQL Compare from Redgate. They allow you to compare pretty much everything from the actual data to the schema.
I dont believe there is any native functionality in sqlserver.
Compare SQL Server schemas and deploy differences fast
Compare and deploy SQL Server database contents
Is there a way to write a single query so that if you are connected to database A it does one thing and if you are connected to database B it does another?
I am using SSMS 2008 to access SQL 2000 servers.
You can define views on database A and on database B with the same name and columns, but different construction. Then your query is just to select from the view.
Need an SQL query to connect the two tables that are in two different database,the databases are located in different servers.I am using SQL 2005.
You need (and should be googling) Linked Servers
http://technet.microsoft.com/en-us/library/ms188279.aspx
I have two different databases (on same server) and i want to join tables across databases. I am using Hibernate, is it possible to create a query in hibernate which can join two tables in those databases?
Hibernate will create an SQL query for your HQL or Criteria query and this SQL will be sent through jdbc to the database. This means that hibernate does not support for what you are trying to do.
However, you can achieve the same result in some cases. Some databases give you the option to create an alias for a table that resides in a different database. So you will be able to write an SQL query that joins the two tables and execute it on the database.
We are doing that with DB2.
If you can do that, it depends on your database.
I guess, that it would impossible if you have two different databases (example DB2 and MySQL) but if both databases are of the same vendor, then maybe it's achievable.
You should try to find more info in you database server's documentation.