December 12, 2002 at 1:15 pm
Hello,
I need help on this.
trying to build a Trigger but it's not working, the statement is that.
CREATE TRIGGER [tdlist] ON [dbo].[trunkDList]
FOR INSERT
AS
INSERT INTO TRUNK_LINES
(trunkid)
select 'T'+rtrim(RDB) from trunkDlist
any help will be appreciate
thanks
December 12, 2002 at 2:32 pm
First everytime you do an Insert you will get all the Records from trunkDList inserted again. I think you are looking for this
INSERT TRUNK_LINES (trunkid) SELECT 'T'+rtrim(RDB) From inserted
If that doesn't work can you pleas explain the issue in more detail (Phone company stuff ye-haw).
December 12, 2002 at 5:08 pm
probably want to change the "from trunkdlist" to "from inserted" as Anatares did.
Steve Jones
December 13, 2002 at 6:53 am
well now I'm getting an error:
Cannot Insert the NULL into column TIMESTAMP on trunk_lines
means that , the table I'm trying to update has a timestamp autonumber and do not accept nulls, How I fix that ?
thanks
Nelson
December 13, 2002 at 11:37 am
you should update the table that the trigger is on, referencing the inserted table & joining over the primary key.
that way you influence the value of the row(s) being inserted, rather than trying to add new ones.
Edited by - sunshinekid on 12/13/2002 12:14:43 PM
December 13, 2002 at 1:06 pm
well my problem is the both they are not related, so is very hard to update the second table after the first been updated, I lost the variable to locate on the second table, don't know how to fix it.
thanks
December 13, 2002 at 2:02 pm
my fault for adding to the confusion - didn't spot you were copying rows across to your other table
don't have any bright ideas for the timestamp - the semantics for timestamp is that you can only insert null into this column & no other value, so it should work.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply