4Learning
asked on
Sybase error text
How does one get a coresponding message text from @@error variable. I want to capture this in either a stored procedure or a batch file
ASKER
Yes, but I need to write the messages to a log file in the following manner...
insert into erro_log values(@@error, error_message)
Well I dont think I can put in the select statement from sysmessages in the insert statement.
Is there another way...?
Thanks,
4learning
insert into erro_log values(@@error, error_message)
Well I dont think I can put in the select statement from sysmessages in the insert statement.
Is there another way...?
Thanks,
4learning
Sure you can.
insert into erro_log
select error, description
from master..sysmessages where error = @@error
insert into erro_log
select error, description
from master..sysmessages where error = @@error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thankyou very much alpmoon. that helps!
Why were full points awarded to alpmoon? His solution is less efficient and is just a modification of mine.
I think what I suggested was useful because in most of the cases you need variables to check the error number later. 4Learning can combine both suggestions anyway.
However, regardless of how useful both solutions, I agree that points should be distributed when another valuable post has been submitted. It could be a suggestion or just a comment. Usually it helps to get a solution faster. I think it is late this time. But, it should be considered every time a question is closed.
However, regardless of how useful both solutions, I agree that points should be distributed when another valuable post has been submitted. It could be a suggestion or just a comment. Usually it helps to get a solution faster. I think it is late this time. But, it should be considered every time a question is closed.
select * from master..sysmessages where error = xxx