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
 General SQL Server Forums
 New to SQL Server Programming
 Better Table Design question:

Author  Topic 

sportsguy
Starting Member

39 Posts

Posted - 2013-02-06 : 12:43:58
Money field

Allow Nulls with default of Zero?
Do Not allow Nulls with default of Zero?

The question comes from the priority of loading and conversion,
such that i either code the loading or use the table functionality. .

remember, I am just an SQL hack, although I have been designing MS Access tables, forms queries and coding for over 20 years. . .

thanks
sportsguy

MS Access 20 years, SQL hack

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-02-06 : 13:08:37
I'll ask a question back. In your case, is NULL different that Zero? I ask becase it CAN be different. But, typically, I'd assume that it should be not null.
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-06 : 13:10:23
It really depends on the business requirements. To my way of thinking, having a default and allowing NULL serve two different purposes, although sometimes people use a 0 (or other logically impossible value) as an indicator of having no value at all.

There is a little bit of storage used for null indicator for variable length data types. Also, if you have a lot of null values, sparse columns may save you storage depending on the percentage of nulls, so that might be a consideration when deciding whether to allow nulls or not.
Go to Top of Page

sportsguy
Starting Member

39 Posts

Posted - 2013-02-06 : 13:44:39
Not a question of having a null value, there aren't any null values anywhere. that was not the question.
There are only zeros or non zero numbers.

The question is one of loading and table structure.

Currently having the table transform the null to zero for me is the easiest method instead of programming the null to zero. . .
I haven't tried the Not Null with a default value of zero. . . yet, but I will answer the question eventually. .

sportsguy

MS Access 20 years, SQL hack
Go to Top of Page

sportsguy
Starting Member

39 Posts

Posted - 2013-02-06 : 13:45:53
Lamprey, thanks for that answer. .

MS Access 20 years, SQL hack
Go to Top of Page
   

- Advertisement -