Hi!

I wish to specify more than one databases in my connection string in a vb.net project, in order to retrieve records from both of them.


For example,

I have 2 databases , database A and database B


I wish to retrieve the city field from the emp tables of both of them, like this


select a.dbo.emp.city from a.dbo.emp union select b.dbo.emp.city from b.dbo.emp


How is this possible?????

I wish to retrieve the city field from the emp tables of both of them, like this
select a.dbo.emp.city from a.dbo.emp union select b.dbo.emp.city from b.dbo.emp
How is this possible?????

Well first, this is more of an SQL question. But anyway, just do it this way following your syntax:

"SELECT a.dbo.emp.city, b.ado.emp.city FROM a.dbo.emp, b.dbo.emp"

Otherwise think of it this way:

"SELECT database1.dbo.table.column, database2.dbo.table.column FROM database1.dbo.table, database2.dbo.table"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.