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 > Database Server Software > MySQL > Blank Numeric/DateTime Fields

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-12-05, 18:38
anduil anduil is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
Blank Numeric/DateTime Fields

I am relatively new to SQL and have come upon a problem. I work in a Clinical Studies department. It is important to my supervisors that no fields are left blank. This becomes a problem for numeric and date fields where the data is unknown. I do not want to use such concentions as 9999 or 01/01/1901 for unknowns due to the fact that they have real value. Essentially I need a code convention for unknown numeric and date values that denotes the data therein as unknown, as opposed to ridiculously large or small.

Does anyone have any suggestions?
Reply With Quote
  #2 (permalink)  
Old 01-12-05, 19:17
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
use NULL

that's what it is intended for -- to indicate unknown values
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-13-05, 11:13
anduil anduil is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
Thanks. That's what I wanted to use from the start, however she views the database from an Access adp so she sees blank fields and that bothers her. Oh well, seems like I don't have any other option. Thanks again.
Reply With Quote
  #4 (permalink)  
Old 01-13-05, 11:51
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
use IIF(ISNULL(field),'this field is null',field) in order to show something when there's really nothing there
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-13-05, 16:24
anduil anduil is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
I can't use that in a numeric field or date/time though, correct?
Reply With Quote
  #6 (permalink)  
Old 01-13-05, 17:59
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
uh..., er, i mean, um..
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 01-13-05, 18:02
anduil anduil is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
haha, thanks though.
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