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 Procedure Help

Author  Topic 

mahasund
Starting Member

2 Posts

Posted - 2004-03-10 : 09:10:33
I am using MS SQL Server 2000.

I have created a Trigger on a table for Insert,Update. (e.g Order Header)

This trigger is calling a procedure to update another table (e.g. Order Lines) based on certain information being changed in the table where trigger is activated.

I have successfully tested the procedure separately from SQLPlus Analyzer, but when I try to use my application to change information, I am getting an error message "Unable to save Data".

I have not coded any specific Transaction, or Raiseerror.

I am new to this process,

Please help with what am I missing?

Thank you very much,

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-03-10 : 09:18:28
First of all, do you have to do this in a trigger? It would be better to control your points of entry through good procedure design. Have one procedure that updates the Order Header table and updates the Order Lines appropriately based on this information.

If you are going to use a trigger anyway, have you made sure the account in your application has execute permission on the procedure the trigger is calling? Is your error on the insert to Order Header or Order Lines?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

mahasund
Starting Member

2 Posts

Posted - 2004-03-10 : 09:51:51
Thanks Derrik for your input,

This is an Order Maintenance Application, maintaining both Header and Details table.

I do not have ability to change this field value at the application level.

Hence I am trying the Trigger/Procedure way.

My alternate question in this case would be:

Is is possible for me to update the same table in my Trigger / Procedure which are being maintained in the application, if so, Could you please guide me how.

All I need to do is to assign a value to a field for ALL lines in Order Lines table from a field value in Order Header table using some mechanism at the database level, because, I cannot modify my application to perform this task.

Thank you again,

Sundar.
Go to Top of Page
   

- Advertisement -