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.
| Author |
Topic |
|
Phylum
Starting Member
10 Posts |
Posted - 2004-02-10 : 01:46:01
|
| Maybe a strange question but here goes. I want to create a field that has a data type of string, but its default value is blank. I do not want to use NULL because then I have to code for it in my app. and I really really don't want to.Phylum |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2004-02-10 : 02:07:58
|
| set default as ' 'He is a fool for five minutes who asks , but who does not ask remains a fool for life! |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-02-10 : 03:29:10
|
Don't be lazy, handle nulls. There is a reason why you have a NULL and you have an empty string. A NULL can signify the absence of a value, a missing value or an inapplicable status. I can bet that one day your management is going to ask you for a report of all people who have a missing value in that column, you'll be in trouble Having said that, I don't see your question...did you trying creating a default?OS |
 |
|
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2004-02-10 : 04:56:49
|
| I completely disagree with Mohdowais.When management asks the question, simply run a comparison against your default. When they ask you to count the number of distinct entries in this column, you'll give the correct answer while the NULL design will not.DavidM"SQL-3 is an abomination.." |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-02-10 : 07:27:37
|
| Agreed, David, my argument does not apply well to a character column. But if the same criteria were to be extended to an integer or datetime column, it just wouldn't work. My point was "Dont be lazy, handle nulls. Your application might not be the only one updating data into this table." OS |
 |
|
|
|
|
|
|
|