![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Assume I have a table with only 1 row and all column is 'int'. I just wonder is it possible to use SQL to check if any one of those column contain a 'null' without knowing the column name? For example, create t1 ( i1 int null, i2 int null ....) insert into t1 (i1, i2, ...) values (1, 1, 1, ... , null, 1, ... null, ..) and check if any of those column contain null... |
|
Have fun, Willie |
#3
| |||
| |||
|
|
wilson.sh.tam (AT) gmail (DOT) com wrote: Assume I have a table with only 1 row and all column is 'int'. I just wonder is it possible to use SQL to check if any one of those column contain a 'null' without knowing the column name? For example, create t1 ( i1 int null, i2 int null ....) insert into t1 (i1, i2, ...) values (1, 1, 1, ... , null, 1, ... null, ..) and check if any of those column contain null... Select from t1 where i1 is null or i2 is null or ....... in is null Paul... Have fun, Willie -- plinehan __at__ yahoo __dot__ __com__ XP Pro, SP 2, Oracle, 9.2.0.1.0 (Enterprise Ed.) Interbase 6.0.1.0; When asking database related questions, please give other posters some clues, like operating system, version of db being used and DDL. The exact text and/or number of error messages is useful (!= "it didn't work!"). Thanks. Furthermore, as a courtesy to those who spend time analysing and attempting to help, please do not top post. |
#4
| |||
| |||
|
|
Thanks for your reply. Yes, I should have mention this. The databases are mysql 5.0.22 and postgresql v7.4.13. I am running them on FreeBSD 6.1 release box. |
|
Select from t1 where i1 is null or i2 is null or ....... in is null |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
just wonder is it possible to use SQL to check if any one of those column contain a 'null' without knowing the column name? |
#7
| |||
| |||
|
|
Assume I have a table with only 1 row and all column is INTEGER. I just wonder is it possible to use SQL to check if any one of those column contain a 'null' without knowing the column name? |
#8
| |||
| |||
|
|
Assume I have a table with only 1 row and all column is INTEGER. I just wonder is it possible to use SQL to check if any one of those column contain a 'null' without knowing the column name? SELECT 'yes' FROM Foobar WHERE (c1 + c2 + c3+ .. + cn) IS NULL; |
![]() |
| Thread Tools | |
| Display Modes | |
| |