The following script was extracted from https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-oacreate-transact-sql
DECLARE @object int;
DECLARE @hr int;
DECLARE @src varchar(255), @desc varchar(255);
EXEC @hr = sp_OACreate 'SQLDMO.SQLServer', @object OUT;
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
raiserror('Error Creating COM Component 0x%x, %s, %s',16,1, @hr, @src, @desc)
RETURN
END;
GO
When running it I get the following error: Msg 50000, Level 16, State 1, Line 82 Error Creating COM Component 0x800401f3, ODSOLE Extended Procedure, Invalid class string
Could you please advice?
Good. Using sp_OACreate
and co is almost always a bad idea these days and you should be thinking CLR integration instead.
The fact that their sample uses COM Objects that we're discontinued with the 2008 R2 version of the product just means that you can't do too much damage by attempting to use the sample without modifying it.
If you are to use these procedures, you ought to be substituting in appropriate values rather than using the sample without modifying it.
User contributions licensed under CC BY-SA 3.0