If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > How do I Check for null fields?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-09-02, 17:48
Tc2037 Tc2037 is offline
Registered User
 
Join Date: Apr 2002
Posts: 5
How do I Check for null fields?

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
Reply With Quote
  #2 (permalink)  
Old 04-09-02, 18:00
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
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
Reply With Quote
  #3 (permalink)  
Old 04-09-02, 23:05
Tc2037 Tc2037 is offline
Registered User
 
Join Date: Apr 2002
Posts: 5
Smile Oh, oops...

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
Reply With Quote
  #4 (permalink)  
Old 04-10-02, 11:14
robert123 robert123 is offline
Registered User
 
Join Date: Apr 2002
Posts: 6
Hi,
Using IS operator u can check for balnk values in any type of column.
eg:-
select sal from emp where ename is null;
Reply With Quote
  #5 (permalink)  
Old 04-10-02, 17:08
Tc2037 Tc2037 is offline
Registered User
 
Join Date: Apr 2002
Posts: 5
Bam! 'er somethin'

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.
Reply With Quote
  #6 (permalink)  
Old 04-25-02, 16:40
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On