?
Solved

Issue with using "for xml"

Posted on 2011-02-15
5
Medium Priority
?
451 Views
Last Modified: 2012-05-11
Hi,
I am using ASE version 15.0.3/EBF 17769 ESD#4/P/Sun_svr4/OS 5.8/ase1503/2768/64-bit.
Recently a functionality was deployed to audit data changes to come key application tables using for xml. The trigger code is as follows:

CREATE TRIGGER tr_XXX ON t_XXX  FOR INSERT, UPDATE, DELETE  
AS
IF @@rowcount = 0 /* no rows deleted */ return
declare @tablename varchar(32)
select @tablename = 't_XXX' INSERT INTO t_Audit_XXX
SELECT @tablename, (select * from deleted for xml),  (select * from inserted for xml),  getdate(), suser_name(), host_name()
IF @@error != 0
BEGIN
PRINT 'An error occurred backing up deleted row'
ROLLBACK TRAN
END
RETURN

The issue is that in some sporadic cases, deletes/inserts in the table t_XXX might fail the trigger execution stating: error 208 : t_XXX not found.
The same statements would then work fine if fired from a different session. In order to make the statment work on the same session, either the trigger has to be dropped or disabled.  Its very difficult to replicate the issue, but in rare cases we have been able to get the same issue across multiple session/macs. Sometimes recompiling the trigger works, in other cases it doesn't.
So not exactly sure what is going wrong here. Has any one else faced this issue? Please advise.
0
Comment
Question by:PrandipBora
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Expert Comment

by:rachmanesha
ID: 34903570
Need help with docgen? [Document generation software] is loaded with stuff to help make the most of docgen. Very good suggestions on how to optimize a docgen system.
0
 
LVL 13

Accepted Solution

by:
alpmoon earned 2000 total points
ID: 34909413
It looks weird. Have you tried Sybase tech support? It might be a known bug and they might be able to help.
0
 

Author Comment

by:PrandipBora
ID: 34913322
Thanks aplmoon. I am raising a case with Sybase now. Can't think of anything else.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 35510894
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question