Nulls and 0 Length

  • Thread starter Thread starter Dan M
  • Start date Start date
D

Dan M

Access XP with SQL Server 2K back end.

Form, bound to table. Field's design specifies nulls not
allowed. Editing bound field, deleting text data and
attempting to save record, record saves.

I understand Access textbox controls pass a zero-length
string rather than a null. SQL Server tables have no easy
setting for not allowing zero-length strings like Jet
tables do.

I have many fields in many tables that do not allow nulls,
and I don't want them to allow zero-length strings
either. However, I'd like to avoid attaching code to each
bound control, or creating hundreds of check constraints.
Isn't there an easier way?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In SQL Server the check constraints can act the same as the Allow Zero
length Strings property in a JET (Access) table. IOW, in Access, when
you set the Allow Zero-Length Strings property to NO, you are, in
effect, creating a check constraint on that column that ensures any data
inserted has a length > 0.

In SQL'r there are RULEs that have been superseded by CHECK CONSTRAINTS,
but are still available. You can define a rule that acts just like a
check constraint and bind it to any column or user-defined data type.
For more info see the BOL article "CREATE RULE."

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQIhG7oechKqOuFEgEQJfJQCgzI6MTN7aUJCZyxBiyja42YxX0h8AoOnT
rqHAyNVKNRoLDMWsdqLyYiTj
=Yz/w
-----END PGP SIGNATURE-----
 
Back
Top