August 10, 2012 at 1:38 pm
Hello,
I have a table with a field called Category, type of varchar(15), default value is '000000000000000'
I just noticed it will get automatically changed to ((0.))
Why and how to fix it?
Thanks.
August 10, 2012 at 1:45 pm
I can't try it in here, but have you tried to assign the default value to REPLICATE( '0', 15)?
August 10, 2012 at 1:59 pm
i couldn't duplicate the behavior yet; the tables i scripted out get teh default value with all zeros, whether in the constraint definition, the scripting of the table or in the data if i add rows.
where are you seeing the default value? when you script the table, or somewhere else?
i tested with 2005,R2 and 2012 so far.
Lowell
August 10, 2012 at 2:00 pm
if you are seeing it in the data values , it could be some process is sending a value for the column with the default; values inserted take precendence over the default value, of course.
Lowell
August 10, 2012 at 2:10 pm
Luis Cazares (8/10/2012)
I can't try it in here, but have you tried to assign the default value to REPLICATE( '0', 15)?
Thank you! It works!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply