473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Querying different databases

Hi,
I'm having two databases in the name of n1,n2 having same design
I want to query both the databases by giving the database name in query
Databases
N1
N2
Table(both database contains same table)
Detail
Table details
No -int
Name -varchar(10)
Now i want to check the detail table in both n1 and n2 using the select
query
For that I have written query it is not working
select * from N1.Detail
Select * from N2.Detail

The above query is not working in query analyser,I'm getting error as
"Invalid object name"
In query analyser the Northwind database is currently selected, anyway
I have given the database name it has to query from N1 database. How to
use a select query with database name?

Mani

Jan 10 '07 #1
1 2727
select * from N1..Detail
Select * from N2..Detail

plmanikan...@gmail.com wrote:
Hi,
I'm having two databases in the name of n1,n2 having same design
I want to query both the databases by giving the database name in query
Databases
N1
N2
Table(both database contains same table)
Detail
Table details
No -int
Name -varchar(10)
Now i want to check the detail table in both n1 and n2 using the select
query
For that I have written query it is not working
select * from N1.Detail
Select * from N2.Detail

The above query is not working in query analyser,I'm getting error as
"Invalid object name"
In query analyser the Northwind database is currently selected, anyway
I have given the database name it has to query from N1 database. How to
use a select query with database name?

Mani
Jan 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: alwaysawn | last post by:
Hi, I have databases on two different machines which I want to select from in one query, any good way of doing this without moving tables from one machine to another? Thanks, Alwaysawn
3
by: Henri | last post by:
Hello, I am quite new to ms-sql and I have a problem : I want to create an SQL request which would copy serveral records from a table in a given database to another table (with exactly the same...
1
by: Rick Brandt | last post by:
I know that a heterogeneous query joining tables from two different servers has performance penalties but is the same true when joining tables from two different databases on the same SQL Server...
2
by: Steve | last post by:
Hi; I am looking for suggestions about how to solve a problem using tsql. I have been asked to create a report concerning 4 tables. Each of the 4 tables is in its own database. The 4...
1
by: Nigel J. Andrews | last post by:
The subject says it really. Is there a way to query the value of $libdir, and I don't mean the dynamic_library_path GUC? I ask because, I have scripts to create databases and I've come to make...
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
5
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an...
2
by: runway27 | last post by:
i am building a registration page where a user register for a username. i am able to insert this into mysql. the situation is every time data is inserted into example table1 in mysql in database1 for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.