Skip to content


Calling Stored Procedure Error – Object cannot be cast from DBNull to other types

CRMLuke asked 9 years ago
I have a map I'm trying to run some tests on using a select top 2.

The source query is a select * from a sql view. The view ensures the field which is the input parameter is never null.

The destination is a stored procedure with one input parameter and two output parameters. 

Whenver I run the procedure via Smart Connect I'm getting "Object cannot be acst from DBNull to other types". I've tried checking the source field by putting it into a Calculated field but I get the same error.

If I script the stored procedure as an Execute to statement and copy/paste the value from the source preview window everything works. Any suggestions are appreciated.
Best Answer
CRMLuke answered 9 years ago
Turns out the problem was that in the body of the procedure no values were being set for the output parameters. Simply adding this line fixed the problem. I will need to go back and update the procedure to do additional error checking and set those values appropriately.

SELECT @error = 0, @message = ''

If you would like to submit an answer or comment, please sign in to the eOne portal.