Professional Web Applications Themes

SQL2K Trigger problem - Microsoft SQL / MS SQL Server

I've got a problem with a trigger I've set on a table. This is the code for the trigger: CREATE TRIGGER Update_Allowance_Rule ON [dbo].[setting_allowance_rule] FOR UPDATE AS UPDATE [dbo].[setting_allowance_condition_rule] SET [dbo].[setting_allowance_condition_rule].rule_description = deleted.rule_description WHERE [dbo].[setting_allowance_condition_rule].allowance_rule_key = deleted.allowance_rule_key The problem that I'm having is that when an update occurs on the setting_allowance_rule the trigger fires but I get the following ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.setting_allowance_condition_rule' setting_allowance_condition_rule does exist, the spelling is correct and it is owned by dbo. The version of the SQL Server ODBC driver is 2000.81.9030.04. For the life of me, I can't see ...

  1. #1

    Default SQL2K Trigger problem

    I've got a problem with a trigger I've set on a table. This is the code for
    the trigger:

    CREATE TRIGGER Update_Allowance_Rule ON [dbo].[setting_allowance_rule]
    FOR UPDATE
    AS
    UPDATE [dbo].[setting_allowance_condition_rule]
    SET [dbo].[setting_allowance_condition_rule].rule_description =
    deleted.rule_description
    WHERE [dbo].[setting_allowance_condition_rule].allowance_rule_key =
    deleted.allowance_rule_key

    The problem that I'm having is that when an update occurs on the
    setting_allowance_rule the trigger fires but I get the following ODBC error:

    [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
    'dbo.setting_allowance_condition_rule'

    setting_allowance_condition_rule does exist, the spelling is correct and it
    is owned by dbo. The version of the SQL Server ODBC driver is
    2000.81.9030.04. For the life of me, I can't see what I've done wrong. Have
    I done something stupid? Any help anyone can offer will be greatly
    appreciated.

    Thanks


    Joe Bertolini


    Joe Bertolini Guest

  2. #2

    Default Re: SQL2K Trigger problem

    You can update other tables from triger, use

    UPDATE [dbo].[setting_allowance_condition_rule]
    SET rule_description = deleted.rule_description
    FROM [dbo].[setting_allowance_condition_rule] inner join deleted on
    [dbo].[setting_allowance_condition_rule].allowance_rule_key =
    deleted.allowance_rule_key

    and if that fails check if setting_allowance_condition_rule really exists.

    KR

    "Joe Bertolini" <Joe.Bertolinibgc-contracting.com.au> wrote in message
    news:Odh13vGQDHA.2160TK2MSFTNGP11.phx.gbl...
    > I've got a problem with a trigger I've set on a table. This is the code
    for
    > the trigger:
    >
    > CREATE TRIGGER Update_Allowance_Rule ON [dbo].[setting_allowance_rule]
    > FOR UPDATE
    > AS
    > UPDATE [dbo].[setting_allowance_condition_rule]
    > SET [dbo].[setting_allowance_condition_rule].rule_description =
    > deleted.rule_description
    > WHERE [dbo].[setting_allowance_condition_rule].allowance_rule_key =
    > deleted.allowance_rule_key
    >
    > The problem that I'm having is that when an update occurs on the
    > setting_allowance_rule the trigger fires but I get the following ODBC
    error:
    >
    > [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
    > 'dbo.setting_allowance_condition_rule'
    >
    > setting_allowance_condition_rule does exist, the spelling is correct and
    it
    > is owned by dbo. The version of the SQL Server ODBC driver is
    > 2000.81.9030.04. For the life of me, I can't see what I've done wrong.
    Have
    > I done something stupid? Any help anyone can offer will be greatly
    > appreciated.
    >
    > Thanks
    >
    >
    > Joe Bertolini
    >
    >

    Kresimir Radosevic Guest

  3. #3

    Default Re: SQL2K Trigger problem

    Joe, first check a table called 'dbo.setting_allowance_condition_rule'
    exists. Then try adding a from clause, "FROM
    dbo.setting_allowance_condition_rule, deleted"

    "Joe Bertolini" <Joe.Bertolinibgc-contracting.com.au> wrote in message
    news:Odh13vGQDHA.2160TK2MSFTNGP11.phx.gbl...
    > I've got a problem with a trigger I've set on a table. This is the code
    for
    > the trigger:
    >
    > CREATE TRIGGER Update_Allowance_Rule ON [dbo].[setting_allowance_rule]
    > FOR UPDATE
    > AS
    > UPDATE [dbo].[setting_allowance_condition_rule]
    > SET [dbo].[setting_allowance_condition_rule].rule_description =
    > deleted.rule_description
    > WHERE [dbo].[setting_allowance_condition_rule].allowance_rule_key =
    > deleted.allowance_rule_key
    >
    > The problem that I'm having is that when an update occurs on the
    > setting_allowance_rule the trigger fires but I get the following ODBC
    error:
    >
    > [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
    > 'dbo.setting_allowance_condition_rule'
    >
    > setting_allowance_condition_rule does exist, the spelling is correct and
    it
    > is owned by dbo. The version of the SQL Server ODBC driver is
    > 2000.81.9030.04. For the life of me, I can't see what I've done wrong.
    Have
    > I done something stupid? Any help anyone can offer will be greatly
    > appreciated.
    >
    > Thanks
    >
    >
    > Joe Bertolini
    >
    >

    Anthony Faull Guest

  4. #4

    Default Re: SQL2K Trigger problem

    Thanks for your reply. Unfortunately neither suggestion worked and
    dbo.setting_allowance_condition_rule definitely does exist. Guess I'll just
    have to kludge in code in the front end app, Yuk!

    Thanks anyway.

    "Kresimir Radosevic" <kresimir.radoseviczg.tel.hr> wrote in message
    news:u0DdoLHQDHA.2316TK2MSFTNGP11.phx.gbl...
    > You can update other tables from triger, use
    >
    > UPDATE [dbo].[setting_allowance_condition_rule]
    > SET rule_description = deleted.rule_description
    > FROM [dbo].[setting_allowance_condition_rule] inner join deleted on
    > [dbo].[setting_allowance_condition_rule].allowance_rule_key =
    > deleted.allowance_rule_key
    >
    > and if that fails check if setting_allowance_condition_rule really exists.
    >
    > KR
    >
    > "Joe Bertolini" <Joe.Bertolinibgc-contracting.com.au> wrote in message
    > news:Odh13vGQDHA.2160TK2MSFTNGP11.phx.gbl...
    > > I've got a problem with a trigger I've set on a table. This is the code
    > for
    > > the trigger:
    > >
    > > CREATE TRIGGER Update_Allowance_Rule ON [dbo].[setting_allowance_rule]
    > > FOR UPDATE
    > > AS
    > > UPDATE [dbo].[setting_allowance_condition_rule]
    > > SET [dbo].[setting_allowance_condition_rule].rule_description =
    > > deleted.rule_description
    > > WHERE [dbo].[setting_allowance_condition_rule].allowance_rule_key =
    > > deleted.allowance_rule_key
    > >
    > > The problem that I'm having is that when an update occurs on the
    > > setting_allowance_rule the trigger fires but I get the following ODBC
    > error:
    > >
    > > [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
    > > 'dbo.setting_allowance_condition_rule'
    > >
    > > setting_allowance_condition_rule does exist, the spelling is correct and
    > it
    > > is owned by dbo. The version of the SQL Server ODBC driver is
    > > 2000.81.9030.04. For the life of me, I can't see what I've done wrong.
    > Have
    > > I done something stupid? Any help anyone can offer will be greatly
    > > appreciated.
    > >
    > > Thanks
    > >
    > >
    > > Joe Bertolini
    > >
    > >
    >
    >

    Joe Bertolini Guest

Similar Threads

  1. Slow SQL2k JDBC from Linux
    By lnagy in forum Coldfusion Database Access
    Replies: 0
    Last Post: April 1st, 05:21 PM
  2. Problem creating trigger-function with arguments (8.0rc4)
    By Michael Fuhr in forum PostgreSQL / PGSQL
    Replies: 5
    Last Post: January 7th, 11:08 PM
  3. Replies: 1
    Last Post: August 7th, 08:37 PM
  4. Update trigger problem
    By Stephen F Zelonis in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 8th, 01:52 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139