SQL query to create a field that allows 0-length strings

  • Thread starter Thread starter Manolain
  • Start date Start date
M

Manolain

I cant find the way to create a text field that allows null values

This is the syntax I am trying is following:

alter table xxx add column xcxc text(20) null

but when I do this, although parameter 'required' is 'No' parameter
'allow 0-length string' is aslo set to No

thank you for your response
 
A zero-length string ("") and Null aren't the same thing. A zero-length
string is a value: Null means the value isn't known. If the field is
supposed to store middle initials, for instance, Null would mean you don't
know the person's middle initial, whereas as "" would mean the person
doesn't have a middle initial.

If you want to be able to store Nulls, you cannot have the AllowZeroLength
property set to true. Check http://support.microsoft.com/?id=209098 It
explicitly states:

"The AllowZeroLength property determines whether a zero-length string ("")
is a valid entry. The Required property determines whether a Null value is a
valid value. Although these two properties work together, the
AllowZeroLength property overrides the Required property."

In any case, I'm not sure it's possible using the ALTER TABLE DDL. You may
have to use DAO (or ADOX) to set the field's AllowZeroLength property.
 
Back
Top