|
|
Archives of the TeradataForum
Message Posted: Wed, 19 Mar 2008 @ 18:16:23 GMT
Subj: | | Re: Comparing blanks and Nulls |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Wed, 19 Mar 2008 09:19 -->
If you insert a value into a VARCHAR field with whitespace Teradata will store the whitespace at the end of the string. For example:
TableA:
RowId BYTEINT
Name VARCHAR(10)
INSERT INTO TABLEA VALUES (1,'John');
INSERT INTO TABLEA VALUES (2,'Johnny ');
SELECT RoWID, Name, CHARACTER_LENGTH(Name) FROM TableA;
You should get:
1, John, 4
2, Johnny , 8
You should also be able to store a zero length string ('') in both VARCHAR and CHAR fields. NULLIF(TRIM(ColA), '') should suffice in
place of a CASE statement.
| |