Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem executing 'sp_droptask' inside a trigger

Status
Not open for further replies.

chrisv71

Programmer
Mar 25, 2002
5
US
I have a problem using sp_droptask within a trigger in a Powerbuilder application on a SQL database. The existing code worked in SQL6.5 but is failing since converting to SQL7.0/2000. There are two processes the "compile" and the "analysis" with separate status tables. Both are stored procedures initiated by the App using sp_addtask. When finished, the status tables get updated with the date/time which is supposed to fire the UPDATE trigger to drop the scheduled task (using sp_droptask) on the task name. I know sp_addtask/droptask are older SQL6.5 syntax but have been maintained in the newer application since it may be run against SQL6.5/7.0/2000 databases. The strange thing is that the compile starts, runs to completion, and the trigger correctly fires and removes the task from the server. At that point the analysis process starts, runs to completion, but its trigger is unable to drop the task and the App is left hanging because it appears as if the analysis did not finish. The trigger is virtually identical in both processes with minor changes to table and column names only. The problem is debugging, since sp_droptask fails in the trigger the entire transaction is rolled back so I can't verify the data at the point of processing. I suspect there are values which are not what they are supposed to be which prevents the task name from being identified properly (the actual task name is created dynamically since it is specific to the criteria of the compile/analysis). I tried using temp tables to store data in the process but I'm unable to save any information because of the rollback. When the process is hung at the end, if I manually update the specific column in the analysis status table in the SQL Query Analyzer(using the expected values to identify the row) the trigger fires properly and the application proceeds normally...

Does anyone have any suggestions for debugging within a trigger?? Any help would be appreciated, thanks.

-Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top