CREATE PROCEDURE sp_displayoaerrorinfo
    @object int,
    @hresult int
AS
DECLARE @hrhex char(10), @hr int, @source varchar(255), @description varchar(255)
PRINT 'OLE Automation Error Information'
EXEC sp_hexadecimal @hresult, @hrhex OUT
PRINT '  HRESULT: ' + @hrhex
EXEC @hr = sp_OAGetErrorInfo @object, @source OUT, @description OUT
IF @hr = 0
BEGIN
    PRINT '  Source: ' + @source
    PRINT  '  Description: ' + @description
END
ELSE
BEGIN
    PRINT '  sp_OAGetErrorInfo failed.'
    RETURN
END
GO
This page was last updated on May 01, 2006 04:28 PM.