Question

I'm connected to an OpenEdge DataServer via ODBC (not our product, we are just accessing their database, I hardly have any information and certainly no help from the other side).

Anyhow, I just need to execute a simple Select, add a couple of rows and I need the equivalent of an IsNull statement.

Basically I'd like to execute

SELECT ISNULL(NULL,'test')

This fails with a Syntax Error. I've looked around at something they misleadingly call a "documentation" but there are only references to SP_SQL_ISNULL but I can't get that to work either. I'm fit in T-SQL, so any pointers in any direction appreciated, even if it's just a RTFM with a link to TFM :)

Thanks

Was it helpful?

Solution

Thanks to Catalin and this question I got on the right track. I kept thinking I needed a OpenEdge specific function but actually I needed to use only ODBC SQL syntax.

To get what

ISNULL(col,4) 

does you can use

COALESCE(col,4) 

which "returns the data type of expression with the highest data type precedence. If all expressions are nonnullable, the result is typed as nonnullable."MSDN

Basically it will convert to 4 if the value is null (and therefore not convertable).

OTHER TIPS

I am not 100% sure, but I think ODBC driver expects a valid SQL statement, and not an DBMS specific SQL statement, like the one you provided.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top