I have two databases in a same sever of MS SQL Server 2005. Now I want to make query from tables of each database. How can I do this ? and how will connect to both databases at time to peform query in tables of both using UNION clause.
Nasreen
Printable View
I have two databases in a same sever of MS SQL Server 2005. Now I want to make query from tables of each database. How can I do this ? and how will connect to both databases at time to peform query in tables of both using UNION clause.
Nasreen
Something like:
select top 1 * from Database..Table T1
join database..table T2 on T1.Key = T2.Key
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)
The connection string can only connect to one database.
As TysonLPrice used the fully qualified name for both databases, it does not matter which one you connect to - you just run the query in the usual way.
The problems you might get are based around the permissions within the database... if that happens, tell us the details of the problem.