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 not working

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-06-30 : 11:16:43
Hi

I have a frond end asp.net application which updates data into a table

"customers" via stored procedure. I have a trigger on the customers table that inserts the changed data into a log table for every update. But when i do the update from the front end(asp.net application) the trigger is not working but when i change the data in the customers table (at the database level) it works fine and inserts dat in the log table

What is the problem? Thanks in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-06-30 : 11:22:33
post your trigger code here


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 11:35:20
quote:
Originally posted by akpaga

Hi

I have a frond end asp.net application which updates data into a table

"customers" via stored procedure. I have a trigger on the customers table that inserts the changed data into a log table for every update. But when i do the update from the front end(asp.net application) the trigger is not working but when i change the data in the customers table (at the database level) it works fine and inserts dat in the log table

What is the problem? Thanks in advance


How are inserting into customer? Also it would be helpful if you can post trigger code?
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-06-30 : 11:59:48
sorry the code was wrong
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 12:55:59
Can i ask what you're trying to do inside trigger? Are you trying to insert the old values to BusinessMembersInfo_log?
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-06-30 : 13:00:59
yes i was inserting old values
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 13:09:07
quote:
Originally posted by akpaga

yes i was inserting old values


Ok so wats your requirement? put the old values into log during update? wats the initial IF for?whats the relevance of 2,8,9 columns?
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-06-30 : 13:16:35
the intial if means:
if these coloumn numbers 2,8,9 are updated then insert into log table .
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 13:25:23
Can you replace that if with this and try?

IF EXISTS(SELECT 1 FROM inserted i
INNER JOIN deleted d
ON i.pk=d.pk--primary key
AND i.col2<>d.col2--cols 2,8,9
AND i.col8<> d.col8
AND i.col9<>d.col9)
--your insert here

also wht is purpose of last where not exits?
Go to Top of Page
   

- Advertisement -