Char columns NULL space emptiness
I had this experience with NULL and Change Capture stage. So I needed explicit NULL handling but stumble over another problem, well it rather is a problem of mine but I feel prone to forget about it, so maybe this post reminds me of it.
I tried to set up NULL handling for a char(3) column by first converting the content of the column in a transformer stage using NullToEmpty() doing the change capture and reconverting the empty string to NULL before writing to the database. I was surprised to find the string ' ' instead of a null value in the database. You probably spotted the problem right away, but it took me some hours to get to wisdom over it however. The point is, that char columns can be NULL but there is no emptiness. By definition a char is a string right padded to its length with space characters...
So I reformed the replacement by some very unlikely i. e. three non-printable characters like bell, device control three, negative acknowledgement.
However, my debug peek acted funnily...
I tried to set up NULL handling for a char(3) column by first converting the content of the column in a transformer stage using NullToEmpty() doing the change capture and reconverting the empty string to NULL before writing to the database. I was surprised to find the string ' ' instead of a null value in the database. You probably spotted the problem right away, but it took me some hours to get to wisdom over it however. The point is, that char columns can be NULL but there is no emptiness. By definition a char is a string right padded to its length with space characters...
So I reformed the replacement by some very unlikely i. e. three non-printable characters like bell, device control three, negative acknowledgement.
However, my debug peek acted funnily...
Kommentare
Kommentar veröffentlichen