Hello there,
I have the following columns in a table: 'Name', 'ssn, 'age'.
The values for these columns are:
SUN 6666 24
5555 26
Raj 7777 25
8888 23
The first column contains Null values. I am trying to separate this into two files based on the column 'Name'. I am using IsNull(Name) then 'file1' else 'file2' condition. This is working fine when the value in the 'Name' column is 'null'. But when there are some spaces in the 'Name' column instead of Null this condition is not working.
Can anyone explain to me what the problem is.
Thanx in advance.
-Yamini
Dealing with Null columns
Moderators: chulett, rschirm, roy
NULL is not the same as spaces. ISNULL is used to detect for the null condition, but to check for spaces requires that you do a string comparison.
If you want to trim for spaces and then check for blank and also deal with the null condition, use the following statement:
Non-spaces or not null will evaluate to TRUE.
If you want to trim for spaces and then check for blank and also deal with the null condition, use the following statement:
Code: Select all
NOT(ISNULL(link.column)) OR LEN(TRIM(link.column)) > 0
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle