November 24, 2010 at 3:49 am
Hi All,
I have to add a new column to my table. The column is NULLABLE.
So, i would like to know which is better setting the default as 0 or Null?
Probability is that since its a new column and we already have over a million records, all those will be null and the data will be recorded for this column from now on....
keeping this is mind i must decide on this. (or will they dont make diff? m not sure)
Please advice.
Thanks,
Malavika.
November 24, 2010 at 3:51 am
Depends on the column, what it stores, what the data means and what 'unknown' means in the context of that data column.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 24, 2010 at 3:56 am
Thanks for the reply.
i have 5 such columns. 4 are of type int and one is a varchar column.
now after adding them we will have to filter out the null values in the queries. would that have any impact on the performance?
i am worried because there are two tables and one of them already has 1billion rows!!
now if i make 1bn rows as null and apply filter what would be the impact?
m currently working on this, so your suggestions will be helpful.
November 24, 2010 at 4:03 am
For interger columns you can go for the default as 0(zero). You may have Varchar column as null.But make sure that you should not query based on the null column in where condition,in which the result set differs.
It's completly depend on the functionality that column need to be null or not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply