Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2008
    Posts
    3

    Unanswered: Table merge from multiple databases

    Hi.

    I have a question I hope somebody will be able to help answer. I've worked almost exclusively with Oracle for almost 7 years, and now have to do some work on Sybase databases, but am struggling to accomplish some of the basic tasks.

    The main goal is to write stored procedure/routing to merge identical tables from DIFFERENT databases, possibly on different servers.

    The questions I have are:

    1. How can I reference a table from another database in sql query?
    In Oracle I can create database links, but how is it done in Sybase?

    2. Next, I plan to do a row count comparison of each table in different databases (ex: DB1.TABLE_A and DB2.TABLE_A), and if they differe, run a reconciliation routine. Again, I Oracle I could have used MERGE statement and merge the tables based on a KEY field. Is there a similar statement available in Sybase?

    I guess If I figure out how to read data from another database, I should be able to code the simple merge logic for item 2 above.

    Look forward to your replies, and appologies for some basic questions.

    S.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    1) look up proxy tables
    2) No

  3. #3
    Join Date
    Mar 2008
    Posts
    96
    1. In sybase u can have more than one databases in one database instance. So if other database is on the same instance then u can access the tables of another database as following
    Suppose u r in database A and u want to access the table T of database B, then the quesry will be like
    select * from B..T

    2. if ur other database is on a physically different server go to the link
    http://infocenter.sybase.com/help/index.jsp
    and serch for remote server

  4. #4
    Join Date
    Jun 2008
    Posts
    3
    Thank you.

  5. #5
    Join Date
    Jun 2008
    Posts
    3
    Would you be kind to post the equivalent of Oracle "desc table" command?

    Or is the only way to get meta data on table colums is by quering one of the "sys" tables?

  6. #6
    Join Date
    Dec 2007
    Location
    Chennai,India
    Posts
    12
    1. sp_help table_name
    2. sp_columns table_name

  7. #7
    Join Date
    Nov 2008
    Posts
    2
    I need to write a stored procedure/routing to merge identical tables from DIFFERENT databases

  8. #8
    Join Date
    Dec 2007
    Location
    Chennai,India
    Posts
    12

Posting Permissions

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