I want to use the fallowing function in my SQL-Server:
CREATE FUNCTION RTF2TXT(@in varchar(8000)) RETURNS varchar(8000) AS
BEGIN
DECLARE @object int
DECLARE @hr int
DECLARE @out varchar(8000)
-- Create an object that points to the SQL Server
EXEC @hr = sp_OACreate 'RICHTEXT.RichtextCtrl', @object OUT
EXEC @hr = sp_OASetProperty @object, 'TextRTF', @in
EXEC @hr = sp_OAGetProperty @object, 'Text', @out OUT
EXEC @hr = sp_OADestroy @object
RETURN @out
END
GO
The Problem is, that I always get NULL from the function. It cannot create the RICHTEXT.RichtextCtrl-Object. I think, the problem is, that this is a x64 Server. Does someone have an Idea how I can solve this?
I have already done successfully:
sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
sp_configure 'Ole Automation Procedures', 1
GO
RECONFIGURE WITH OVERRIDE
GO
to enable OLE.
I have previously done similar things using CLR stored procedures. Is this an option for you?