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)
 Trigger madness, help!

Author  Topic 

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-26 : 16:41:07
Hello all,
I have a trigger problem that is make me more nutz than I already am.
The trigger as written:
create trigger tr_updateitemshipdate
on dbo.ps_tkt_lin
for insert,update
as
set nocount on
update tl
set tl.tkt_ship_dat=th.ship_dat,
tl.item_ship_dat=
case
when tl.tkt_ship_dat is not null and tl.item_ship_dat is null
then tl.tkt_ship_dat
when d.tkt_ship_dat=tl.item_ship_dat
then i.tkt_ship_dat
when d.tkt_ship_dat<>tl.item_ship_dat
then tl.tkt_ship_dat
end
from ps_tkt_hdr th
inner join ps_tkt_lin tl
on tl.str_id=th.str_id
and tl.sta_id=th.sta_id
and tl.tkt_no=th.tkt_no
inner join inserted i
on i.str_id=tl.str_id
and i.sta_id=tl.sta_id
and i.tkt_no=tl.tkt_no
inner join deleted d
on d.str_id=tl.str_id
and d.sta_id=tl.sta_id
and d.tkt_no=tl.tkt_no
set noucount off

what happens is this:
when the app creates an invoice, the invoice header info is written to ps_tkt_hdr, and then the items on the invoice are written to ps_tkt_lin.
What DOES work:
1)when a new invoice is created, the header table ship date gets copied to the line table ticket ship date(tkt_ship_dat), and then tkt_ship_dat fills item_ship_dat(when tl.tkt_ship_dat is not null and tl.item_ship_dat is null
then tl.tkt_ship_dat).
2)If we change the header ship date, and the old ship date DOES NOT match the item ship date, then DO NOT change the item ship date(when d.tkt_ship_dat<>tl.item_ship_dat
then tl.item_ship_dat). This seems to work(PS_TKT_LIN.TKT_SHIP_DAT changes, but ITEM_SHIP_DAT does not;in fact, it NEVER changes after the initial value is inserted), but since (1) below ISN'T working, I thought this might be a questionable area..
What DOESN'T work:
1)If we change the header ship date, and the old ship date matched the item ship date, then change the item ship date as well(when d.tkt_ship_dat=tl.item_ship_dat
then i.tkt_ship_dat). PS_TKT_LIN.TKT_SHIP_DAT changes, but ITEM_SHIP_DAT does not.

Apparently the deleted.tkt_ship_dat NEVER equals ITEM_SHIP_DAT,
even when they do...
Is there something stupid I am missing (could be!) or do I have this inherently wrong? The two tables are keyed together (the keys are the JOIN columns; plus ps_tkt_lin's key includes sequencing on SEQ_NO) but that does not seem to be the issue, as the update from PS_TKT_HDR.SHIP_DAT to PS_TKT_LIN.TKT_SHIP_DAT works ok. I can post CREATE table stuff if you need it, but I think I am just missing SOMETHING silly..
Andy

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

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-12-26 : 20:06:25
To make the logic easier consider writing separate triggers for insert and update.
The sample trigger will only work for updates ( since there is no deleted table in the case of an insert ).

Now You say:
>>"What DOESN'T work:
1)If we change the header ship date, and the old ship date matched the item ship date, then change the item ship date as well(when d.tkt_ship_dat=tl.item_ship_dat
then i.tkt_ship_dat). PS_TKT_LIN.TKT_SHIP_DAT changes, but ITEM_SHIP_DAT does not.
"

The trigger is on the ps_tkt_lin table, not on the ps_tkt_hdr table,
so any updates on the ps_tkt_hdr table will not be taken care of in any triggers on the ps_tkt_lin table!

It would help if You posted the current Table structures and the current triggers on the tables ps_tkt_hdr + ps_tkt_lin.

rockmoose
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-26 : 21:50:39
Ahh,
thanks for popping in Rockmoose. Wasn't sure if I should email you or not (hate to impose). Anyway, The deleted and inserted that I am trying to work with is all on the PS_TKT_LIN table. In the first part of the trigger, PS_TKT_HDR.SHIP_DAT is copied to PS_TKT_LIN.TKT_SHIP_DAT. What I am trying to do is:
IF DELETED.TKT_SHIP_DAT(from PS_TKT_LIN)=PS_TKT_LIN.ITEM_SHIP_DAT
then set PS_TKT_LIN.ITEM_SHIP_DAT=INSERTED.TKT_SHIP_DAT(the new value for PS_TKT_LIN.TKT_SHIP_DAT)
ELSE IF DELETED.TKT_SHIP_DAT(from PS_TKT_LIN)<>PS_TKT_LIN.ITEM_SHIP_DAT
then set PS_TKT_LIN.ITEM_SHIP_DAT=ITSELF(no change)

The whole reason for this mess is this:
I tried putting triggers on the HEADER table to directly update the line table. Not only did we run into all kinds of problems with the app taking forever to save a ticket, it also would not reliably update the lines. After pulling all of my hair out, I called the vendor, and the only thing they offered up was that the app insert/updates the header first, and then the lines, so a new ticket would not copy the ship date over initially as there were no lines to copy to. I thought about splitting the trigger between both tables, having one on the line table to do the initial insert and then one on the header for the updates, but that seemed like a loop problem waiting to happen. My workaround idea was to add the TKT_SHIP_DAT to the line table, make a simple trigger on the line table to copy the ship date from the header, and then do our item ship date changes off of that. I originally had this on the header:
create trigger tr_UpdateItemShipDate
on dbo.PS_TKT_HDR
for insert, update
as

update tl
set tl.ITEM_SHIP_DAT =
case
when th.ship_dat is null
then tl.item_ship_dat
when th.ship_dat is not null and tl.Item_ship_dat is null
then th.ship_dat
when th.ship_dat is not null and tl.item_ship_dat=d.ship_dat
then th.ship_dat
when th.ship_dat is not null and tl.item_ship_dat<>d.ship_dat
then tl.item_ship_dat
end
from inserted i
inner join PS_TKT_HDR th
on i.STR_ID = th.STR_ID
and i.STA_ID = th.STA_ID
and i.TKT_NO = th.TKT_NO
inner join PS_TKT_LIN tl
on th.STR_ID = tl.STR_ID
and th.STA_ID = tl.STA_ID
and th.TKT_NO = tl.TKT_NO
and i.SEQ_NO = tl.SEQ_NO
inner join deleted d
on d.STR_ID = th.STR_ID
and d.STA_ID = th.STA_ID
and d.TKT_NO = th.TKT_NO

This did not work either, AND the ticket save time is something like 25 seconds, which is definitly NOT good!
I think maybe I am suffering from mycodus crappus, and that this is just not written right. I have taken any other triggers off of both tables at this point, with no change. It has been VERY busy at work, and I've been screwing up even the simplest things the past week or so. I'm home today, but I can send you some table code tomorrow if you would like. By the way,
Happy holidays!
Andy

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

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-12-27 : 06:13:37
You could try something like this.
( Maybe my understanding of the situation is not complete, but I commented the triggers )
I have 1 trigger on PS_TKT_HDR that takes care of updating ITEM_SHIP_DAT in PS_TKT_LIN when SHIP_DAT is updated
And 1 trigger on PS_TKT_LIN that assigns ITEM_SHIP_DAT for insert

-- PS_TKT_HDR table:
CREATE TABLE test_PS_TKT_HDR
(
STR_ID varchar(10),
STA_ID varchar(10),
TKT_NO varchar(15),
CONSTRAINT PK_test_PS_TKT_HDR PRIMARY KEY CLUSTERED(STR_ID,STA_ID,TKT_NO),
SHIP_DAT datetime
)

-- PS_TKT_LIN table:
CREATE TABLE test_PS_TKT_LIN
(
STR_ID varchar(10),
STA_ID varchar(10),
TKT_NO varchar(15),
SEQ_NO int,
CONSTRAINT PK_test_PS_TKT_LIN PRIMARY KEY CLUSTERED(STR_ID,STA_ID,TKT_NO,SEQ_NO),
CONSTRAINT FK_test_PS_TKT_HDR FOREIGN KEY(STR_ID,STA_ID,TKT_NO) REFERENCES test_PS_TKT_HDR(STR_ID,STA_ID,TKT_NO),
ITEM_SHIP_DAT datetime
)
GO

ALTER TRIGGER trgtest_PS_TKT_HDR ON test_PS_TKT_HDR FOR UPDATE
AS
BEGIN
/*
When SHIP_DAT is updated in table test_PS_TKT_HDR
then update ITEM_SHIP_DAT in table test_PS_TKT_LIN under following condidtions:
1. There is a non NULL SHIP_DAT value in table test_PS_TKT_HDR
2. If ln.ITEM_SHIP_DAT is NULL then set it to hdr.SHIP_DAT
3. If ln.ITEM_SHIP_DAT is NOT NULL then only update where the old hdr.SHIP_DAT matches ln.ITEM_SHIP_DAT
*/
IF UPDATE(SHIP_DAT)
UPDATE ln SET
ln.ITEM_SHIP_DAT = hdr.SHIP_DAT
FROM
test_PS_TKT_LIN ln
JOIN test_PS_TKT_HDR hdr
ON ln.STR_ID = hdr.STR_ID
AND ln.STA_ID = hdr.STA_ID
AND ln.TKT_NO = hdr.TKT_NO
JOIN deleted d
ON ln.STR_ID = d.STR_ID
AND ln.STA_ID = d.STA_ID
AND ln.TKT_NO = d.TKT_NO
WHERE
hdr.SHIP_DAT IS NOT NULL
AND
( d.SHIP_DAT = ln.ITEM_SHIP_DAT OR ln.ITEM_SHIP_DAT IS NULL )
END
GO

CREATE TRIGGER trgtest_PS_TKT_LIN ON test_PS_TKT_LIN FOR INSERT
AS
BEGIN
/*
When a row is inserted in table test_PS_TKT_LIN
Set the ITEM_SHIP_DAT to SHIP_DAT from table test_PS_TKT_HDR
provided that:
a) no value was explicitly provided for ITEM_SHIP_DAT
b) there is a non NULL SHIP_DAT value in table test_PS_TKT_HDR
*/
UPDATE ln SET
ln.ITEM_SHIP_DAT = hdr.SHIP_DAT
FROM
test_PS_TKT_LIN ln
JOIN test_PS_TKT_HDR hdr
ON ln.STR_ID = hdr.STR_ID
AND ln.STA_ID = hdr.STA_ID
AND ln.TKT_NO = hdr.TKT_NO
/*JOIN inserted i
ON ln.STR_ID = i.STR_ID
AND ln.STA_ID = i.STA_ID
AND ln.TKT_NO = i.TKT_NO
AND ln.SEQ_NO = i.SEQ_NO*/
WHERE
ln.ITEM_SHIP_DAT IS NULL
AND hdr.SHIP_DAT IS NOT NULL
END
GO


-- Cleanup
DROP TABLE test_PS_TKT_LIN
DROP TABLE test_PS_TKT_HDR


rockmoose
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-27 : 16:14:54
Ok Rockmoose,
Almost hit a homerun here. The trigger that does the initial update to the lines works fine, and with the trigger you wrote on the header table the ticket same time is fine. You can set an initial ship date in the header and it copies to the line table, and if you change an individual line ship date it stays that way ok. Only thing not working is when you change the header ship date and it matches the old item ship date: It doesn't update the lines...
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 - 2004-12-27 : 21:56:01
Just got a chance to look at this trigger that isn't behaving; aren't the tables in red backwards?:
CREATE TRIGGER trgtest_PS_TKT_LIN ON test_PS_TKT_LIN FOR INSERT
AS
BEGIN
/*
When a row is inserted in table test_PS_TKT_LIN
Set the ITEM_SHIP_DAT to SHIP_DAT from table test_PS_TKT_HDR
provided that:
a) no value was explicitly provided for ITEM_SHIP_DAT
b) there is a non NULL SHIP_DAT value in table test_PS_TKT_HDR
*/
UPDATE ln SET
ln.ITEM_SHIP_DAT = hdr.SHIP_DAT
FROM
test_PS_TKT_LIN ln
JOIN test_PS_TKT_HDR hdr
ON ln.STR_ID = hdr.STR_ID
AND ln.STA_ID = hdr.STA_ID
AND ln.TKT_NO = hdr.TKT_NO
/*JOIN inserted i
ON ln.STR_ID = i.STR_ID
AND ln.STA_ID = i.STA_ID
AND ln.TKT_NO = i.TKT_NO
AND ln.SEQ_NO = i.SEQ_NO*/
WHERE
ln.ITEM_SHIP_DAT IS NULL
AND hdr.SHIP_DAT IS NOT NULL


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

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-27 : 22:00:44
If you mean should it be
test_PS_TKT_HDR hdr
JOIN test_PS_TKT_LIN ln


doesn't make any difference.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-28 : 06:57:28
Hi nr, Thanks for jumping in.
Ok then, any ideas as to why this won't work? It all looks ok, but the header trigger doesn't update the line table. I only had a few minutes to play with it yesterday; the only thing I had to change was to add set nocount on/off. could this have something to do with it? Seems odd...
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 - 2004-12-28 : 07:40:19
I just realized I posted the LINE TABLE trigger instead of the HEADER table trigger(oops!). Here is the trigger that isn't working:

set nocount on
IF UPDATE(SHIP_DAT)
UPDATE ln SET
ln.ITEM_SHIP_DAT = hdr.SHIP_DAT
FROM
test_PS_TKT_LIN ln
JOIN test_PS_TKT_HDR hdr
ON ln.STR_ID = hdr.STR_ID
AND ln.STA_ID = hdr.STA_ID
AND ln.TKT_NO = hdr.TKT_NO
JOIN deleted d
ON ln.STR_ID = d.STR_ID
AND ln.STA_ID = d.STA_ID
AND ln.TKT_NO = d.TKT_NO
WHERE
hdr.SHIP_DAT IS NOT NULL
AND
( d.SHIP_DAT = ln.ITEM_SHIP_DAT OR ln.ITEM_SHIP_DAT IS NULL )
set nocount off

If I put this trigger on the HEADER table without nocount on/off, then the app won't run. I don't think this is the issue; Also, since the trigger on the line table handles the possibility of a NULL item_ship_dat, do we need that in the WHERE clause on the HEADER as well?
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 - 2004-12-28 : 11:28:12
Update:
these triggers work in query analyzer, but not in the app. The INSERT trigger is ok, but the UPDATE trigger doesn't work. After much testing, here is what I have found:
set nocount on
IF UPDATE(SHIP_DAT)
UPDATE ln SET
ln.ITEM_SHIP_DAT = hdr.SHIP_DAT
FROM
test_PS_TKT_LIN ln
JOIN test_PS_TKT_HDR hdr
ON ln.STR_ID = hdr.STR_ID
AND ln.STA_ID = hdr.STA_ID
AND ln.TKT_NO = hdr.TKT_NO
JOIN deleted d
ON ln.STR_ID = d.STR_ID
AND ln.STA_ID = d.STA_ID
AND ln.TKT_NO = d.TKT_NO
WHERE
hdr.SHIP_DAT IS NOT NULL
AND
( d.SHIP_DAT = ln.ITEM_SHIP_DAT OR ln.ITEM_SHIP_DAT IS NULL )

set nocount off

If I change the RED items to hdr instead of tl and remove the GREEN line, then it will update. As when I originally started out:
quote:
Apparently the deleted.tkt_ship_dat NEVER equals ITEM_SHIP_DAT,
even when they do...

I am assuming that the app is doing something with the line or header table during INSERT or UPDATE so that the trigger doesn't 'see' the proper values. The line trigger that originally sets the item ship date from the header works, but going the other way only works if it is a straight-up update, not based on a comparison with the line table. Any ideas?

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

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-28 : 12:19:10
changing ln. to hdr. won't make any difference as the values are equal from the previous join and it's the pk on hdr - but the trigger is on hdr so you should join deleted to hdr.

The only way chamging the last line could make it work is if the ln.ITEM_SHIP_DAT is not null and the old hdr.SHIP_DAT isn't equal to it.

When you check the dates to see if it should update are you also checking the miilliseconds?
Note this will not update if the old hdr.SHIP_DAT was null and ln.ITEM_SHIP_DAT is not null.



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-28 : 12:55:54
quote:
changing ln. to hdr. won't make any difference as the values are equal from the previous join and it's the pk on hdr - but the trigger is on hdr so you should join deleted to hdr.

I agree, but if I leave it at ln it doesn't work.
quote:
The only way chamging the last line could make it work is if the ln.ITEM_SHIP_DAT is not null and the old hdr.SHIP_DAT isn't equal to it.
Note this will not update if the old hdr.SHIP_DAT was null and ln.ITEM_SHIP_DAT is not null.

Again, I agree, but even when they DO match and there are no NULLS involved, it doesn't work.
quote:

When you check the dates to see if it should update are you also checking the miilliseconds?

If you are referring to the time after each date, all of the times are 00:00:00.000
Does this help? And did you have a good holiday?
Andy

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

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-28 : 13:27:04
OK - what you're saying isn't possible (unless you've hit a bug).
Try this - which looks correct using your original tables and update trigger.

insert test_PS_TKT_HDR select '1', '1', '1', '20040101'
insert test_PS_TKT_HDR select '1', '1', '2', '20040102'

insert test_PS_TKT_LIN select '1', '1', '1', '1', '20040101'
insert test_PS_TKT_LIN select '1', '1', '1', '2', '20040201'
insert test_PS_TKT_LIN select '1', '1', '1', '3', null

insert test_PS_TKT_LIN select '1', '1', '2', '1', '20040101'
insert test_PS_TKT_LIN select '1', '1', '2', '2', '20040201'
insert test_PS_TKT_LIN select '1', '1', '2', '3', null

begin tran
select * from test_PS_TKT_LIN
update test_PS_TKT_HDR set SHIP_DAT = '20031212' where TKT_NO = 1
select * from test_PS_TKT_LIN
rollback tran

results
STR_ID STA_ID TKT_NO SEQ_NO ITEM_SHIP_DAT
---------- ---------- --------------- ----------- ------------------------------------------------------
1 1 1 1 2004-01-01 00:00:00.000
1 1 1 2 2004-02-01 00:00:00.000
1 1 1 3 NULL
1 1 2 1 2004-01-01 00:00:00.000
1 1 2 2 2004-02-01 00:00:00.000
1 1 2 3 NULL

(6 row(s) affected)


(2 row(s) affected)


(1 row(s) affected)

STR_ID STA_ID TKT_NO SEQ_NO ITEM_SHIP_DAT
---------- ---------- --------------- ----------- ------------------------------------------------------
1 1 1 1 2003-12-12 00:00:00.000
1 1 1 2 2004-02-01 00:00:00.000
1 1 1 3 2003-12-12 00:00:00.000
1 1 2 1 2004-01-01 00:00:00.000
1 1 2 2 2004-02-01 00:00:00.000
1 1 2 3 NULL

(6 row(s) affected)


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-28 : 14:32:04
Ok,
It is definetly something to do with the App. I created a ticket using the app, and then tried to update the ship date. Did not work. I went into query analyzer and did:
update ps_tkt_hdr
set ship_dat='12/31/2004'
where tkt_no='6696'

This updated the header, and in turn updated the lines as well. I also set item dates to be different, and it modifies when they match, and leaves them alone when they don't. I believe the trigger as written is fine, but the App is doing SOMETHING to screw it up.
Any ideas on a workaround or solution? My last thought was to add a column to the line table, do a simple update from the header to the line table with the ship date, and then modify the item_ship_dat off of that. Seems like a lot of work, and there must be some sort of answer for what we have set up at this point.
HELP!

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

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-28 : 14:39:12
Try using the profiler to see what the app is doing.
Might be doing multiple updates.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2004-12-28 : 17:02:56
Well,
My profiler expertise is a bit subpar, but I believe you are correct. I ran profiler and noticed that there are several updates that are done, for the ticket header, ticket payment, ticket tax codes, and ticket lines.
So,
What about having a trigger on the line table to copy the header ship date straight up to another column(say tkt_ship_dat), and then a trigger (or more lines in the first trigger) to use that value to modify the item_ship_dat value?
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 - 2004-12-29 : 09:26:45
Hey nr & rockmoose,
Spent some time with SQL Profiler, and nr was right on with the multiple updates. I re-wrote the code on the line table to two triggers and added a column TKT_SHIP_DAT:
CREATE TRIGGER updateitemsd ON [dbo].[PS_TKT_LIN] 
FOR INSERT, UPDATE, DELETE
AS
/* When SHIP_DAT is updated in table PS_TKT_HDR then update ITEM_SHIP_DATE
in table PS_TKT_LIN under the following conditions:
a) There is a non-null SHIP_DAT value in PS_TKT_HDR
b) If tl.ITEM_SHIP_DAT is NULL then set it to th.SHIP_DAT
c) If tl.ITEM_SHIP_DAT is NOT NULL then only update if it matches old th.SHIP_DAT
*/
set nocount on
if update(TKT_SHIP_DAT)
update tl set
tl.ITEM_SHIP_DAT=tl.TKT_SHIP_DAT
from PS_TKT_LIN tl

join deleted d
on tl.STR_ID=d.STR_ID
and tl.STA_ID=d.STA_ID
and tl.TKT_NO=d.TKT_NO
where
tl.TKT_SHIP_DAT is not null
and (d.TKT_SHIP_DAT=tl.ITEM_SHIP_DAT or tl.item_ship_dat is null)

set nocount off

-------------------------------------------------------------------

CREATE trigger tr_UpdateItemShipDate
on dbo.PS_TKT_LIN
for insert
as
set nocount on

/*When a row is inserted in table PS_TKT_LIN
set the ITEM_SHIP_DAT to PS_TKT_HDR.SHIP_DAT provided that:
a) no value was explicitly provided for ITEM_SHIP_DAT
b) there is a non-null SHIP_DAT value in PS_TKT_HDR
*/

update tl
set tl.TKT_SHIP_DAT = th.SHIP_DAT

from PS_TKT_LIN tl
join PS_TKT_HDR th
on tl.STR_ID = th.STR_ID
and tl.STA_ID = th.STA_ID
and tl.TKT_NO = th.TKT_NO

This works fine. I really appreciate all the help!
Andy

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

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-01-03 : 05:57:20
Adding column TKT_SHIP_DAT to table PS_TKT_LIN is really a hotfix and workaround.
(it has the same value as SHIP_DAT in table PS_TKT_HDR right?)
So what gives is that the database gets denormalized and You will get more sources for errors and data corruption.

Well anyway, good that You made it work somehow,
and keep your hands on the steering wheel when coding

rockmoose
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-01-03 : 08:20:29
Yes sir,
Certainly is a hotfix. I really don't see another way around it at this point, and since it is only one column, I guess I can handle the inevitable spasm that is bound to happen, HEY! Did I see your name announcing your certification? Congrats!
And Happy New Year!
Andy

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

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-01-03 : 09:07:53
>> Congrats!
Thanx Andy ,

Joyous, bugfree and Happy New Year!!!

rockmoose
Go to Top of Page

steamngn
Constraint Violating Yak Guru

306 Posts

Posted - 2005-01-03 : 09:14:46
Joyous, YES!
Bug free, cut it out!

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

- Advertisement -