Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Cannot DELETE with this trigger installed[SOLVED]

Author  Topic 

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-02-25 : 12:07:50
Hi again gang,
I have a table with the following long-winded trigger on it:
create trigger tr_UpdateTimeTableBillCity
on TimeTable
for insert, update
as

update tt
set tt.city01 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time01 = th.tkt_no

update tt
set tt.city02 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time02 = th.tkt_no

update tt
set tt.city03 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time03 = th.tkt_no

update tt
set tt.city04 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time04 = th.tkt_no

update tt
set tt.city05 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time05 = th.tkt_no

update tt
set tt.city06 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time06 = th.tkt_no

update tt
set tt.city07 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time07 = th.tkt_no

update tt
set tt.city08 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time08 = th.tkt_no

update tt
set tt.city09 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time09 = th.tkt_no

update tt
set tt.city10 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time10 = th.tkt_no

update tt
set tt.city11 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time11 = th.tkt_no

update tt
set tt.city12 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time12 = th.tkt_no

update tt
set tt.city13 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time13 = th.tkt_no

update tt
set tt.city14 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time14 = th.tkt_no

update tt
set tt.city15 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time15 = th.tkt_no

update tt
set tt.city16 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time16 = th.tkt_no

update tt
set tt.city17 = th.bill_city
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time17 = th.tkt_no

update tt
set tt.Cust01 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time01 = th.tkt_no

update tt
set tt.Cust02 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time02 = th.tkt_no

update tt
set tt.Cust03 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time03 = th.tkt_no

update tt
set tt.Cust04 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time04 = th.tkt_no

update tt
set tt.Cust05 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time05 = th.tkt_no

update tt
set tt.Cust06 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time06 = th.tkt_no

update tt
set tt.Cust07 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time07 = th.tkt_no

update tt
set tt.Cust08 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time08 = th.tkt_no

update tt
set tt.Cust09 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time09 = th.tkt_no

update tt
set tt.Cust10 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time10 = th.tkt_no

update tt
set tt.Cust11 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time11 = th.tkt_no

update tt
set tt.Cust12 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time12 = th.tkt_no

update tt
set tt.Cust13 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time13 = th.tkt_no

update tt
set tt.Cust14 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time14 = th.tkt_no

update tt
set tt.Cust15 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time15 = th.tkt_no

update tt
set tt.Cust16 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time16 = th.tkt_no

update tt
set tt.Cust17 = th.bill_lst_nam
from inserted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time17 = th.tkt_no


This trigger works fine when a record is INSERTED or UPDATED
(The user insets a ticket number into any of the 'timexx' columns and this trigger updates the corresponding city and name columns), but if a user tries to DELETE a record from the timexx columns, we get "another user has made conflicting changes. cancel your changes and try again." Take off this trigger and it works fine. I am looking to rewrite this trigger into some thing more efficient (if possible) and to fix the DELETE issue.
Any help is as always greatly appreciated..
Andy

There's never enough time to type code right,
but always enough time for a hotfix...

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-02-25 : 13:43:42
This trigger should not fire at all on a delete, since it is an insert and update trigger.

Do you have more than one trigger on this table?

Codo Ergo Sum
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-02-25 : 14:14:31
Hey Michael,
When I first got put on this project there were actually 4 triggers on this table, one of them a DELETE trigger that I thought for sure was the problem. At the moment the only trigger on the table is the one posted here. I know it should not be doing anything during a delete, but as long as this trigger is on the table the app pukes and throws the error. I suppose it is possible that this is an app issue, but if I take off this trigger then it works fine.
Here is the lowdown:
If we insert a svc call, it works, and if we CHANGE the call from one number to another, it works, but if we DELETE the call (set timexx to null) then it blows up. MY thought was this:
The trigger is trying to update fields, but since we are setting the timexx value to null the trigger cannot find the appropriate ticket in the JOIN statements to do the update with, and so blows up. What I need is to have this trigger that will update the table when a value is present the way it is written ELSE update the table with null when the timexx column is set to the same.
Here is the DELETE trigger that I originally thought was the culprit, and basically is what we need to incorporate(I think) into the first trigger:
CREATE trigger tr_deleteTimeTableShipCity
on dbo.TimeTable
for delete
as

update tt
set tt.city01 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time01 = th.tkt_no

update tt
set tt.city02 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time02 = th.tkt_no

update tt
set tt.city03 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time03 = th.tkt_no

update tt
set tt.city04 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time04 = th.tkt_no

update tt
set tt.city05 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time05 = th.tkt_no

update tt
set tt.city06 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time06 = th.tkt_no

update tt
set tt.city07 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time07 = th.tkt_no

update tt
set tt.city08 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time08 = th.tkt_no

update tt
set tt.city09 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time09 = th.tkt_no

update tt
set tt.city10 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time10 = th.tkt_no

update tt
set tt.city11 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time11 = th.tkt_no

update tt
set tt.city12 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time12 = th.tkt_no

update tt
set tt.city13 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time13 = th.tkt_no

update tt
set tt.city14 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time14 = th.tkt_no

update tt
set tt.city15 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time15 = th.tkt_no

update tt
set tt.city16 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time16 = th.tkt_no

update tt
set tt.city17 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time17 = th.tkt_no

update tt
set tt.Cust01 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time01 = th.tkt_no

update tt
set tt.Cust02 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time02 = th.tkt_no

update tt
set tt.Cust03 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time03 = th.tkt_no

update tt
set tt.Cust04 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time04 = th.tkt_no

update tt
set tt.Cust05 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time05 = th.tkt_no

update tt
set tt.Cust06 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time06 = th.tkt_no

update tt
set tt.Cust07 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time07 = th.tkt_no

update tt
set tt.Cust08 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time08 = th.tkt_no

update tt
set tt.Cust09 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time09 = th.tkt_no

update tt
set tt.Cust10 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time10 = th.tkt_no

update tt
set tt.Cust11 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time11 = th.tkt_no

update tt
set tt.Cust12 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time12 = th.tkt_no

update tt
set tt.Cust13 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time13 = th.tkt_no

update tt
set tt.Cust14 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time14 = th.tkt_no

update tt
set tt.Cust15 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time15 = th.tkt_no

update tt
set tt.Cust16 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time16 = th.tkt_no

update tt
set tt.Cust17 = null
from deleted i
inner join timetable tt
on i.NAM = tt.NAM
and i.SVC_DAT = tt.SVC_DAT
inner join ps_tkt_hdr th
on tt.time17 = th.tkt_no

Any Ideas?

There's never enough time to type code right,
but always enough time for a hotfix...
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-02-25 : 14:16:15
Holy Denormalized batman

I would normalize my table and lose that trigger...

What are you trying to do?

"Initialize" a row to the database?

Why put "empty" data in for data's sake?

Also if it's an INSERT, how can the row already be in TimeTable? Don't you need an AFTER Trigger?





Brett

8-)
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-02-25 : 15:00:59
Hey Brett..
Yeah, isn't this some frightening stuff?
The table is denormalized as hell, here's how it works:
the table is created from a procedure. What happens is the proc selects every user who is a servicer, takes a date range supplied to the proc, and inserts into the table one row for each servicer per day. the columns time01,time04, etc. are where the ticket number goes for each service call. In reality the whole mess was written for just these timexx columns(which of course negates the trigger), but the app being used doesn't allow for lookup on tables other than the one being used, and as such the scheduler needs to see the name of the customer and the city that they live in.
SOOOOOO.......
I have been put on the project from hell. I'm not real thrilled about it, but I gotta try...
I'm wondering if we can't solve this issue using the AFTER trigger idea, or maybe a proc called from a trigger?
I mean, what the hell, we're already running against the grain with this!
Andy

There's never enough time to type code right,
but always enough time for a hotfix...
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-02-25 : 17:01:56
Maybe what you could do is normalize the data, and then create a view that cross tabs the data.

Then you could forget about fixing the trigger from hell.

Of course, that's easier said than done.

quote:
Originally posted by steamngn

Hey Brett..
Yeah, isn't this some frightening stuff?
The table is denormalized as hell, here's how it works:
the table is created from a procedure. What happens is the proc selects every user who is a servicer, takes a date range supplied to the proc, and inserts into the table one row for each servicer per day. the columns time01,time04, etc. are where the ticket number goes for each service call. In reality the whole mess was written for just these timexx columns(which of course negates the trigger), but the app being used doesn't allow for lookup on tables other than the one being used, and as such the scheduler needs to see the name of the customer and the city that they live in.
SOOOOOO.......
I have been put on the project from hell. I'm not real thrilled about it, but I gotta try...
I'm wondering if we can't solve this issue using the AFTER trigger idea, or maybe a proc called from a trigger?
I mean, what the hell, we're already running against the grain with this!
Andy

There's never enough time to type code right,
but always enough time for a hotfix...



Codo Ergo Sum
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-25 : 17:09:40
You need to run SQL Profiler to determine what the application is doing on delete as that trigger isn't the problem. I realize you say if you remove it then everything works fine. Perhaps you could generate the DDL for your TimeTable and include all triggers.

Tara
Go to Top of Page

PW
Yak Posting Veteran

95 Posts

Posted - 2005-02-25 : 17:35:31
Original post stated:

>>but if a user tries to DELETE a record from the timexx columns

You can't DELETE from a COLUMN.

Do you mean DELETE record, or do you mean UPDATE record and set some values NULL ?

Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-02-25 : 18:34:55
Hey Tara, PW,
I THINK what the app is doing isn't really a DELETE but an UPDATE as you suggest. Tara is right, I need to get on profiler and see what's what here. I'm pretty sure that If I change the trigger to do something different if the inserted value is null that will solve the problem. Just for ha-ha's I sent a note to the app vendor telling them we need to have lookups based on views...
What a dreamer I am! Anyway, I will jump back into it tomorrow and see if I can't shed some more light on this disaster.
Andy

There's never enough time to type code right,
but always enough time for a hotfix...
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-02-26 : 09:20:29
Good Morning Boys and Girls,
Ran through Profiler this AM, and sure enough, this is an UPDATE using NULL as the value(DUH! After I thought about it a minute, of course it is. The rowset isn't being removed, just the data in one column!). So, The first trigger will be ok if it takes NULL into account. Since the trigger is blowing up on a NULL update, it looks like the JOIN is where the problem is....
And We're off!! who will be the first to cross the finish line with this marvelous piece o' code?
might-not-be-me,
Andy

There's never enough time to type code right,
but always enough time for a hotfix...
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-02-27 : 14:18:59
This was almost TOO easy:
CREATE   TRIGGER updatecityandname ON [dbo].[TimeTable] 
FOR INSERT, UPDATE, DELETE
AS

update tt
set city01=(select bill_city from ps_tkt_hdr
where tkt_no=time01),
cust01=(select bill_nam from ps_tkt_hdr
where tkt_no=time01)
from timetable tt

update tt
set city04=(select bill_city from ps_tkt_hdr
where tkt_no=time04),
cust04=(select bill_nam from ps_tkt_hdr
where tkt_no=time04)
from timetable tt

update tt
set city07=(select bill_city from ps_tkt_hdr
where tkt_no=time07),
cust07=(select bill_nam from ps_tkt_hdr
where tkt_no=time07)
from timetable tt


update tt
set city10=(select bill_city from ps_tkt_hdr
where tkt_no=time10),
cust10=(select bill_nam from ps_tkt_hdr
where tkt_no=time10)
from timetable tt


update tt
set city13=(select bill_city from ps_tkt_hdr
where tkt_no=time13),
cust13=(select bill_nam from ps_tkt_hdr
where tkt_no=time13)
from timetable tt


update tt
set city16=(select bill_city from ps_tkt_hdr
where tkt_no=time16),
cust16=(select bill_nam from ps_tkt_hdr
where tkt_no=time16)
from timetable tt


The problem was that the app AND the trigger were performing an update on the table using INSERTED. This trigger has resolved the conflict, although the table is still denormalized and ugly...
Andy

There's never enough time to type code right,
but always enough time for a hotfix...
Go to Top of Page
   

- Advertisement -