[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can you have a no-default column; error if unspecified?


Is it possible to set a column to have no possible default value, so if you try to create a record that doesn't specify a value for that column, you'll get an error?

For example, if I have a table where the "date" field should always be set. I took out the default "NULL" value, but that just gave it a default value of 0000-00-00. What I want to ensure is that it's not possible to create a record for which the date value hasn't been specified.

(Yes, there's a certain amount of responsibility that's up to the user of the table to remember to set these things, but you should always write lower-level constructs to ensure that, to the maximum extent possible, errors will be harder to commit when making usage of those constructs at a higher level. That goes for tables at the lower level and insertions into those tables at the higher level.)

	-Bennett

bennett@xxxxxxxxxxxxx     http://www.peacefire.org
(425) 649 9024


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread92862@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.