Union of two tables in different databases from within a VB6 application

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

smeechie_at_yahoo.com
Date: 02/22/05


Date: 22 Feb 2005 12:18:35 -0800


>>From within SQL Query analyzer, I can create the union of two different
tables located in separate databases (on the same server). This works
fine. How can I achieve the same result programmatically (using VB6)??
Since the tables are in different databases ... do I need one
connection string for each database?? Or is there a better / more
efficient way to do this? The Union in Query analyzer looks like this:
(the value for 'AAA' is passed to the query via the VB6 application.

==================
Select ID, Description, Qty from XXXX2.dbo.PART where ID like '%AAA%'
Union ALL
Select PartNum, Manu, Available from YYYY2.dbo.PART2 where PartNum like
'%AAA%'
==================

Any help would be appreciated. Thanks so very much for any help..

Don-



Relevant Pages

  • Re: Combined tables in Access!
    ... If it's just for reporting purposes, you can use a UNION query, and ... databases, thus requiring no modifications to those databases ... You must view the query in SQL view in order to create it -- Union ... data using a form with a combo drop down list with their unique product codes. ...
    (microsoft.public.access.tablesdbdesign)
  • RE: Hiding MS SQL databases in Enterprise Manager
    ... analyzer enumerates the databases). ... Query Analyzer goes further and checks permissions before ... around htis problem is to multiple virtual instances of SQL server for each ... > security issue, I would like to set it up so that users can only see ...
    (Focus-Microsoft)
  • Re: Find something in any field
    ... The reason this is difficult is that databases aren't made to work ... exclude the construction of a table with 42 identical columns. ... You can actually insert these into such a table using a UNION ALL ... SELECT PrimaryKeyColumn, 1 AS NameNumber, F1 AS Name ...
    (microsoft.public.access.queries)
  • Re: Challenging Sort Order for a returned recordset
    ... select desc,'2' SrtKey from businesstypes where desc'Current' ... to UNION the queries together. ... Syntax will probably be different with other Databases. ...
    (microsoft.public.vb.general.discussion)
  • Re: SQL Server needs help from MS Access (or something)
    ... As for updates. ... believe there is a well thought out script that updates all consistent ... objects across all databases, and certain data is universal (zip code ... unlike the query analyzer, which allows you to run code, and then just ...
    (comp.databases.ms-sqlserver)