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)
 No NULLs, date values?

Author  Topic 

Blastrix
Posting Yak Master

208 Posts

Posted - 2001-12-19 : 23:28:11
I'm curious about something. In my database designs I try not to incorporate any NULLs whatsoever. I have read a great deal about how bad they are. But there are a few areas I'm not sure about. For instance, when a row has a datetime field but the dateTime field is maybe not used right away. But using some type of magic value doesn't really seem appropriate. Is this a situation where I should rethink my DB design or is using a NULL in this instance okay?

Nazim
A custom title

1408 Posts

Posted - 2001-12-19 : 23:42:00
IMHO for this kind of situation its absolutely ok. you can always work with your records basing upon null's upon missing value, there are other approaches too. for instance people keep an arbitarary value say '01-Jan-1900' for date or 99999.99 for numeric value or something like that to deduce a missing value . but you have to be sure these values will not occur in your original data.





-------------------------
"Success is when Preparedness meets Opportunity"
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2001-12-19 : 23:42:13
That is a contentious issue

I would go with a NULL, I don't have a problem with them.
Otherwise with dates, in SQL Server if you pass a blank value to them they will evaluate as 1-1-1900 or something, so maybe that is a possibility.



Damian
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2001-12-19 : 23:43:05
Damn, beaten by 13 seconds .... oh well

Damian
Go to Top of Page

Blastrix
Posting Yak Master

208 Posts

Posted - 2001-12-20 : 00:02:03
Thanks for the help guys.

Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2001-12-20 : 00:49:47
I like your thinking Blastrix.

A NULL wouldn't be so bad here but a more "theoritcal" (Don't hit me anyone!) approach would be to make a one-to-one relationship.

That way you can use EXISTS instead of IS NULL.

Of course it will be slower but that is the price you pay for avoiding a NULL or dodgy date in this scenario.


DavidM

"Why are you crying?"

"Because I love a Microsoft product"
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2001-12-20 : 00:51:48
David how will a Exist help in this kinda scenario. yeah as u told it can ONLY give you time overhead. dont you think so??

Yeah Merkin isnt Sqlteam a game of Rat Race .

Every second counts here , some1 told me 13 isnt a lucky 1, atleast for u

-------------------------
"Success is when Preparedness meets Opportunity"

Edited by - Nazim on 12/20/2001 00:56:29
Go to Top of Page
   

- Advertisement -