Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
DLL has the same code as the script task(sending message to MSMQ)
Stored Procedure Syntax:

create PROCEDURE [dbo].[prcSendMSMQMessage]
@msmqPath varchar(255),
@messageBody varchar(1000)

AS

DECLARE @msmqQueue INT
DECLARE @result INT

-- Create the SQLMSMQ Object.
EXECUTE @result = sp_OACreate 'SqlMSMQ.SqlMsmq', @msmqQueue OUT, 1
IF @result <> 0 GOTO ErrorHandler

-- Send the message using the Send method
EXECUTE @result = sp_OAMethod @msmqQueue, 'SendMessage', NULL, @msmqPath, @messageBody
IF @result <> 0 GOTO ErrorHandler

GOTO DestroyObjects

ErrorHandler:

DECLARE @source varchar(53)
DECLARE @description VARCHAR(200)
EXECUTE sp_OAGetErrorInfo @msmqQueue, @source OUT, @description OUT, NULL, NULL
RAISERROR(@description, 16, 1)

GOTO DestroyObjects

DestroyObjects:
-- Destroy the SQLMSMQ object.
EXECUTE @result = sp_OADestroy @msmqQueue

RETURN


Promblem:
This step
EXECUTE @result = sp_OACreate 'SqlMSMQ.SqlMsmq', @msmqQueue OUT, 1
gives result as -2146234334 which fails
Posted
Comments
Abdulnazark 2-Mar-15 2:35am    
did you enabled the

sp_configure 'show advanced options', 1
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1
GO
RECONFIGURE;
GO

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900