I have a TABLE that has 70 columns. I need to check if any of them is NULL or empty, for a LOGGED on user.What will be the best way for it.
Depends upon what flavour of SQL you're using.
In Oracle, I use:
WHERE (columnName IS NULL
OR columnName = ''
OR length(columnName) = 0)
actually, what you posted will work in all systems
possible exception is the LENGTH() function, as the standard is CHARACTER_LENGTH()
p.s. your last two conditions are equivalent
I like to be absolutely, positively sure. Just my anal-retentive brain showing one of my pedantic tendencies.
I think some databases will see a blank '' as null (Oracle does, for sure), others will not.
Hi,My table has 60columns, do i need to write all?
that is definitely "messed" up (as well as non-standard)
then m dead.. no array option here?
Might be easier to have whatever server side language you're using fire off a SELECT query to get the table then loop through each row of the result set and have oit loop through each field of result set to look for null or empty fields and do whatever you need to do with the fields. Then once a row of the result set has been dealt with, if any changes have been made, fire off an UPDATE query to write the changes to the database.
Hey hi.. I m using PHp..when a user will login in, it will check his profile data and if any field is empty , will give a update message to him. But i don't know how to use array in that.
The requirement is that ALL 60 COLUMNS must be filled with data? 60???
(The client must be NSA.)
60 columns suggests a possible opportunity for normalization
This topic is now closed. New replies are no longer allowed.