SalesForce NULL errors in SQL Server

If you are reading SalesForce data into SQL Server through a linked server you might encounter null data errors that look like this:

An unexpected NULL value was returned for column … from OLE DB provider … for linked server … This column cannot be null.

You can be remedy this problem by testing the column that is throwing the null error with the nullif function:

OPENQUERY(SALESFORCE_DB,
‘SELECT
nullif( [ErrorColumn], ””) as ResolvedErrorColumn
From [MyTable]’)

(Note: those are 4 single quotes after [ErrorColumn])

A where clause to filter out the nulls of the said data set did not work in my case.

Leave a Reply

Your email address will not be published. Required fields are marked *