Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 checkoperator in sql or mysql

Author  Topic 

rameshgoudd
Starting Member

13 Posts

Posted - 2008-01-03 : 23:16:21
hi,

in my table i have a column named seats..datatype is int...and this seats value dynamcally changes..

how can i set the sesta value..means it should not be less than 0

in sql or mysql

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-03 : 23:22:09
You can put check constraints (value must > 0) on the column like:

ALTER TABLE CheckTbl
ADD CONSTRAINT chkRow CHECK (seats > 0)
Go to Top of Page

rameshgoudd
Starting Member

13 Posts

Posted - 2008-01-03 : 23:35:16
quote:
Originally posted by rmiao

You can put check constraints (value must > 0) on the column like:

ALTER TABLE CheckTbl
ADD CONSTRAINT chkRow CHECK (seats > 0)



hi i did like that only

if i update the seats with 1..then it is updating ..the condition is not working
Go to Top of Page

Koji Matsumura
Posting Yak Master

141 Posts

Posted - 2008-01-04 : 03:10:39
It is TRUE that 1 > 0.
Go to Top of Page
   

- Advertisement -