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

RE: Second Request - Limit Filed Input


At 11:22 AM 3/20/2001 -0500, Ravi Raman wrote:
You can use an ENUM column type assuming the numerical range is less than
65535 numbers.

http://www.mysql.com/doc/E/N/ENUM.html

One problem I've seen with enums is that I end up with a blank ('') field if I try to insert a row with a value in the enum column that doesn't fit.

Is there a way to get the insert to fail on "bad input" instead?

For example:

mysql> CREATE TABLE Stats (
    ->   Status enum('good','bad') NOT NULL
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO Stats VALUES ('neither');
Query OK, 1 row affected (0.00 sec)

(Can I get this insert to FAIL instead? because...)

mysql> select * FROM Stats;
+--------+
| Status |
+--------+
|        |
+--------+
1 row in set (0.01 sec)

(this isn't always a good thing).

-bill


---------------------------------------------------------------------
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-thread68881@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.