unable to cast object of type 'system.dbnull' to type 'system.string'

Database
Enthusiast

unable to cast object of type 'system.dbnull' to type 'system.string'

We have a query that we know will return nulls for a certain column.  However, in the result set, sometimes we see null and sometiems it returns <Error> in the column when the value should be null.   When I hover over the <Error> value, the below message is displayed.

unable to cast object of type 'system.dbnull' to type 'system.string'

I have not seen this before and would like some help in determining how this can be fixed.

Tags (2)
3 REPLIES
Enthusiast

Re: unable to cast object of type 'system.dbnull' to type 'system.string'

Can you please give more details?

Enthusiast

Re: unable to cast object of type 'system.dbnull' to type 'system.string'

A user runs a query in SQL Assistant and expects null values in a certain column.  In the result set, the null indicator is displayed until row 501.... where it then displays '<Error>' as the value for that column.

I searched for a KA that addresses this issue.  The only one I found seemed to be 'internal' to Teradata... I could not view it.  So, I opened a question with the GSC.  It is a known defect in the  SQLA version that we have.  It is supposed to be fixed in SQLA version 14.10.0.08.

That same query, when exported to a file, returns the null indicator for all 40,000+ rows.

Enthusiast

Re: unable to cast object of type 'system.dbnull' to type 'system.string'

Looks like some defect in casting the Nulls to String for the next row after 'Maximum Number of answer rows to Display' setting in SQL Setting Options.