How to specify CHAR column to accept specific characters

How to specify CHAR column to accept specific characters

am 18.06.2009 11:04:22 von hezjing

--0016e64eca3698efde046c9bb1b7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi
I'm using MySQL 5.1.

How do we create a constraint on char column to accept only character 'A' -
'Z'?


Thank you!

--

Hez

--0016e64eca3698efde046c9bb1b7--

Re: How to specify CHAR column to accept specific characters

am 18.06.2009 12:17:46 von Martijn Tonies

Hi,

> I'm using MySQL 5.1.
>
> How do we create a constraint on char column to accept only character
> 'A' -
> 'Z'?

MySQL doesn't have CHECK constraints, I think the only way to do this
is via a BEFORE INSERT trigger.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: How to specify CHAR column to accept specific characters

am 18.06.2009 16:17:16 von Jerry Schwartz

>-----Original Message-----
>From: hezjing [mailto:hezjing@gmail.com]
>Sent: Thursday, June 18, 2009 5:04 AM
>To: mysql@lists.mysql.com
>Subject: How to specify CHAR column to accept specific characters
>
>Hi
>I'm using MySQL 5.1.
>
>How do we create a constraint on char column to accept only character
>'A' -
>'Z'?
>
>
[JS] Would it be practical to use an ENUM in this case?

>Thank you!
>
>--
>
>Hez




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org