|
Posted by Gert-Jan Strik on 09/25/06 19:13
All you have to do is make sure the default is specified as a string. In
other words, make sure you use single quotes to delimit the value.
Try this:
ALTER TABLE MyTable
ADD CONSTRAINT DF_MyTable_MyColumn
DEFAULT ('123-45-6789')
FOR MyColumn
HTH,
Gert-Jan
tlyczko wrote:
>
> I have a char(11) for SSN, and I would like to default it to
> 123-45-6789 so I can avoid having nulls in this column, and so I can
> easily find the rows in which I need to have a 'correct' SSN
> entered/updated.
>
> I tried using just 123-45-6789, and SQL2005 doesn't seem to be
> defaulting to this value, it seems to be keeping it as
> (((123)-(45))-(6789), and not placing it into this column when a new
> row is created....
>
> Is there some special way I must specify defaults for a char(11) field
> (Yes, I will include the dashes).
>
> Thank you,
> Tom
Navigation:
[Reply to this message]
|