Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Evaluate Table for Null Values

Author  Topic 

dmcknight5
Starting Member

8 Posts

Posted - 2008-06-20 : 10:51:20
Is there an easier way to check a table for null values without listing each column and null evaluation in the where clause?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-20 : 10:54:57
instead of checking every field to null you could just concatenate all the fields and evaluate it to NULL. Presence of NULL in any of fields causes result to be NULL.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-06-20 : 11:21:31
Depends upon your settings, but by default that is true.
However, I think you would get an error trying to concat columns of different datatypes.

e4 d5 xd5 Nf6
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-20 : 11:28:10
quote:
Originally posted by blindman

Depends upon your settings, but by default that is true.
However, I think you would get an error trying to concat columns of different datatypes.

e4 d5 xd5 Nf6


Yup Sure CONCAT NULL YIELDS NULL should be on.
You can cast all other type fields to varchar before concatenating
Go to Top of Page

dmcknight5
Starting Member

8 Posts

Posted - 2008-06-20 : 11:45:50
So there's no way to quickly scan the entire table for any null values without referencing each column.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-06-20 : 16:32:25
quote:
Originally posted by visakh16
You can cast all other type fields to varchar before concatenating


That kind of defeats his goal of avoiding listing all the columns.

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -