SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Better Table Design question:
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sportsguy
Starting Member

USA
38 Posts

Posted - 02/06/2013 :  12:43:58  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 02/06/2013 :  13:08:37  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3699 Posts

Posted - 02/06/2013 :  13:10:23  Show Profile  Reply with Quote
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

USA
38 Posts

Posted - 02/06/2013 :  13:44:39  Show Profile  Reply with Quote
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

USA
38 Posts

Posted - 02/06/2013 :  13:45:53  Show Profile  Reply with Quote
Lamprey, thanks for that answer. .

MS Access 20 years, SQL hack
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000