How to generate column with NULL

Dear all,

as I`m trying to reach the destination format (table on a MSSQL-Server) already in EasyMorph and because in the destination table there is a column with NULL-Values:

How do I achive a column with NULL as only values?

Best regards,
Patrick

Hello Patrick,

you can simply use no expression when calculating a column. See below

If you need to generate an empty value explicitly in some cases (e.g. on condition), you can also use the empty() function.

1 Like

Hi Dmitry,

thanks.

Just for clarification (as we all know “empty value” normally is not the same as NULL :crazy_face:):

This means that NULL is achived by leaving the cell empty in EasyMorph.
On the contrary if I need an empty string in the destination format I will need to specify “” for an empty string value in EasyMorph.

Have I got it right?

BR,
Patrick

Yes, that’s correct.

empty() or no expression returns empty value (similar to NULL).

'' or "" returns a zero-length text string.

Note that in expressions the equality operator returns TRUE for the following condition:

empty() = ''

In expressions, an only in expressions, empty values are equal to zero-length text strings. If you’re not sure if a cell is an empty value or a zero-length text string, the best way to figure it out is to right-click the cell and select “Metadata” to open the Cell Profiler.

image

Also, cells with empty values have a slightly darker background, but it may be hard to notice on some displays.

Finally, keep in mind that an empty value is not the same as NULL in SQL. For instance, they can be used in comparison or matching:

empty() = empty() // TRUE
1 Like

Thank you for this workaround. I've tried a few suggestions from other posts but this one did the trick when combining with a suggestion from another post:

if(len([DATE_DEGREE_RECEIVED]) > 0, [DATE_DEGREE_RECEIVED], [NULL value])
where [NULL value] is literally the name of the dummy column

This finally got rid of the SQL Server error:
Column [DATE_DEGREE_RECEIVED] contains a value which is not compatible with the "date" DB data type:

image

1 Like