var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Capture messages from extended procedure
I am using an extended stored procedure that sends email using SMTP. The procedure can be downloaded here. If I execute the procedure in QA and it fails for some reason, the error message is printed in the Messages tab. Is there any way to capture this message/messages when I use the XP in my stored procedures?
Your help is much appreciated.
Forgive me for bumping, I promise never to do it again, but it's important for me to find out if this is possible.
Yes, it is possible to capture the "print vector" output of an extended stored procedure within a standard stored procedure, but it isn't simple.
The easiest way is to use xp_cmdshell to execute OSQL.EXE and capture its output into a table. This is untested, but you'll get the idea:
My next choice would be to create a DTS package that uses Active-X script to do roughly the same thing. That's more complicated than I want to type right now, but it isn't too hard.
CREATE TABLE #foo (
INSERT INTO #foo (x)
EXECUTE master.dbo.xp_cmdshell 'OSQL -E -Q"EXECUTE sp_who"'
SELECT * FROM #foo
There are other ways that break even more "best practices", but lets not go there unless we really have to!
Thanks for your reply.
It actually works !!! Perhaps it's just me, but don't like the idea to use xp_cmdshell.
Anyway, thank you for you time and expertice.