Unix Technical Forum

SQL2K Trigger problem

This is a discussion on SQL2K Trigger problem within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> I've got a problem with a trigger I've set on a table. This is the code for the trigger: ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 07:11 PM
Joe Bertolini
 
Posts: n/a
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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 07:11 PM
Kresimir Radosevic
 
Posts: n/a
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.Bertolini@bgc-contracting.com.au> wrote in message
news:Odh13vGQDHA.2160@TK2MSFTNGP11.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
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 07:11 PM
Anthony Faull
 
Posts: n/a
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.Bertolini@bgc-contracting.com.au> wrote in message
news:Odh13vGQDHA.2160@TK2MSFTNGP11.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
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 07:11 PM
Joe Bertolini
 
Posts: n/a
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.radosevic@zg.tel.hr> wrote in message
news:u0DdoLHQDHA.2316@TK2MSFTNGP11.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.Bertolini@bgc-contracting.com.au> wrote in message
> news:Odh13vGQDHA.2160@TK2MSFTNGP11.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
> >
> >

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:50 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com