Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    5

    Red face Unanswered: Problem to translate an SQL Server trigger to DB2 trigger

    Hi,

    I want to create a trigger for insert in my table and send a resulted recordset to my application.

    With SQL SERVER transact-sql I can have this :


    CREATE TRIGGER [dbomyTable] ON myTable
    FOR INSERT
    AS
    SELECT myColomn1, myColomn2 FROM INSERTED
    GO

    But BD2 triggers do not alloaw the use of cursors, so how can I obtain the same result in DB2 ?

    Thanks

    @+

  2. #2
    Join Date
    Apr 2003
    Location
    Trier, Germany
    Posts
    28
    Hi, Im not sure, what you really want to do, but DB2-Triggers can act on Tables. But, since Triggers act without the user getting to know this, cannot "send a result". They allways act in the background. Perhaps, you should use a stored Procedure or a function.

  3. #3
    Join Date
    Apr 2003
    Posts
    5
    Originally posted by WizardOfGermany
    Hi, Im not sure, what you really want to do, but DB2-Triggers can act on Tables. But, since Triggers act without the user getting to know this, cannot "send a result". They allways act in the background. Perhaps, you should use a stored Procedure or a function.

    In SQL Server a trigger can return de result (a recordset for example) to the application that do an operation in the table. For example a VB application that insert in the table "myTable" can receive from the trigger a recordset containing the row that is just inserted.
    I can use a stored procedure, but the problem is that there is a big application in production that use the Sql Server database. Now I must migrated the database to DB2. If I change the trigger to stored procedure then the application must be modify too and It will be more difficult to do that.

Posting Permissions

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