Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2014

    Unanswered: switch between multiple databases inside a procedure


    I have a scenario, on which I have to switch between multiple databases inside a procedure.
    I can do this by using some wrappers & servers. But there is a restriction with federation as ALTER command will not work with federation(to alter remote database tables).
    On SQL server inside a procedure we can simply say
    set @p1 = 'use '+@dbname , it will switch to that database.

    My question is how can i programmatic-ally (using procedures) can connect & disconnect to a different database inside a procedure in db2.
    can I run that Connect to database command(its a guess) or something else.

    can some one kindly let me know.

  2. #2
    Join Date
    Apr 2008
    Iasi, Romania
    Provided Answers: 3
    A SQL Server database is different from a DB2 database, is more like a DB2 schema. That's why you can switch between databases in SQL Server procedures.

    For your problem, you may write a script.
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    Join Date
    Jul 2014
    Yes. There is an other one too

    SET PASTHRU is other option

Tags for this Thread

Posting Permissions

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