p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   MySQL (http://p2p.wrox.com/forumdisplay.php?f=99)
-   -   Check values (http://p2p.wrox.com/showthread.php?t=39796)

Dj Kat March 14th, 2006 09:37 AM

Check values
 
Hi,

I need to a contraint for a field,
I tried this line in a create table command
Code:

 project_klasse              char(5) NOT NULL default ''CHECK IN('A','B','C','D'),
This would only allow values a,b,c and d for project_klasse

does anyone know if this is possible in mysql if so what is the right synstax

__________________________________________________ ________
This is my junk I'm gona eat it

ciderpunx March 17th, 2006 08:20 AM

Yah, you can probably use an enum field see:

http://dev.mysql.com/doc/refman/5.0/en/enum.html

HTH
Charlie

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com

Dj Kat March 23rd, 2006 04:10 AM

thnx that seems to be the thing I'm looking for
Postgres Sql has this with check

__________________________________________________ ________
This is my junk I'm gona eat it


All times are GMT -4. The time now is 08:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.