PDA

View Full Version : How do I Check for null fields?


Tc2037
04-09-02, 18:48
Hello,

Im working on an administrator utility for a database, and I need to know a way for a just-created database to detect first-time run. If that is true, then my program will ask that the administrator enter their new password. But what I need to know is how to detect a blank field in SQL.


~~ Tc

alligatorsql.com
04-09-02, 19:00
Hello,

normally you can use IS NULL - means

SELECT * FROM table WHERE field IS NULL

or in procedures

IF(var IS NULL) THEN

But this depends on the database and the language that you use. Please give me hint which database you ar using.

You are developing an adminstration software for relational databases. Can I see your work ? I am very interested in such programs :)

Regards
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com

Tc2037
04-10-02, 00:05
Hello,

Im using SQL, that explenation will be adequate. And yes, I'll post my code when I have most of the kinks worked out.

~~ Tc

robert123
04-10-02, 12:14
Hi,
Using IS operator u can check for balnk values in any type of column.
eg:-
select sal from emp where ename is null;

Tc2037
04-10-02, 18:08
It would be better if everyone could stick to VB code please, Im having trouble understanding the relationship between the VB code and the SQL statements.


~~Tc


Ps. Thanks robert.

rnealejr
04-25-02, 17:40
Blank and NULL are 2 different creatures. In VB to test for null - use the ISNULL function. If you are looking for an empty string then use: "".

Good luck.