Results 1 to 3 of 3

Thread: Data extraction

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4
    I have an SQL for extracting data from 2 tables. However the 2 tables have a different connection each as they are located in different databases. This is easy in Microsoft Access but I can't figure it in VB. How can I create a connection/command that is able to extract data this way (if it is possible)?

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    In SQL server when tables are in different databases you can reference them by the following syntax.

    <server>..<table>.<field>

    so a query would look like this for example:

    "SELECT <Database1>..<table1>.<field1> , <field2> , <field3> FROM <Database1>..<table1> , <table2>"

    field2 and field3 are in the same database - lets say database2 for demonstration purposes, field1 is on the same server but in database1. The connection is pointing at database2.

    Hope this helps


    Things I do when I am bored: DotNetable

  3. #3
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    As long as the databases are on the same server....


    Otherwise you'll need to do something like use Access to link to the tables, with your program reading the data from Access...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width