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)
 triggers

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-12 : 08:14:39
Teresa writes "Hello:

Our university is using SQL Server 2000 to store data from the online application form the applicants use to apply to the university. When the Submit application button is clicked it directs you to the confirmation page displaying the submission id. It all worked fine until I created a trigger on the AAIAP table, the code is below:

if exists (select name
from sysobjects
where name = 'tgOther_FirstName'
and type = 'tr')
drop trigger tgOther_FirstName
GO
CREATE TRIGGER tgOther_FirstName
on AAIAP
for INSERT
AS
if exists (SELECT * FROM inserted where OTHERLASTNAMES > '')
BEGIN
UPDATE AAIAP
SET OTHERFIRSTNAMES = FIRSTNAME
END

the purpose of the trigger was to store the firstname value in otherfirstname field, whenever otherlastname is entered on the web form. All fields come from the same AAIAP table.
The trigger completes that part successfully, I can see firstname stored in otherfirstname, but clicking Submit Application does not direct me to the confirmation page.

Could you help me to figure out why the trigger updates the table, saves data in the database, but does not direct me to the confirmation page?

Thank you,
Teresa Skora
Analyst Programmer"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-12 : 08:25:46
After the Trigger is fired, you need to query Select statement to get the updated result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -