SYMPTOMS
If you have an OLE object with a function that requires 18 or more parameters, the
sp_OAmethod extended stored procedure is unable to retrieve the value passed to the parameter. For example, the following function of an OLE object has 18 parameters and @param18 is an output parameter. If you run this code:
EXEC @ret = sp_OAMethod @objTestOA1, 'Function18',@out1 Output, @param1, @param2, @param3, @param4, @param5, @param6, @param7, @param8, @param9, @param10, @param11, @param12, @param13, @param14, @param15, @param16, @param17, @param18 output.
Instead of retrieving the value expected by the function call,
sp_OAmethod always returns null for @param18.
NOTE: This problem only occurs with output parameters. If you have 18 or more parameters that are all input parameters for a function, the problem does not occur.
WORKAROUND
To work around this problem:
- Code OLE object functions to use 17 or fewer parameters.
-or-
- Use object properties to pass items that cannot be passed with 17 parameters.
The use of output parameters is not the only way to retrieve information from an OLE object. You can code an OLE object to have settable properties. Then, you can retrieve information through the properties by using the
sp_OAProperty extended stored procedure.