How can i avaoid negative values in SQL?
-
hi, What is the SQL querry for not having negative values in the table? thanks,jijo Jijo kuruvila software developer trivandrum
-
hi, What is the SQL querry for not having negative values in the table? thanks,jijo Jijo kuruvila software developer trivandrum
john kuruvila wrote: What is the SQL querry for not having negative values in the table? When you create the table you set a constraint like this:
CREATE TABLE cust_sample
(
cust_id int PRIMARY KEY,
cust_name char(50),
cust_address char(50),
cust_credit_limit money,
CONSTRAINT chk_id CHECK (cust_id BETWEEN 0 and 10000 )
)If the table is already created you can use
ALTER TABLE
in order to add the constraint (See the SQL Help files for how to useALTER TABLE
) Does this help?
Do you want to know more? WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums
-
john kuruvila wrote: What is the SQL querry for not having negative values in the table? When you create the table you set a constraint like this:
CREATE TABLE cust_sample
(
cust_id int PRIMARY KEY,
cust_name char(50),
cust_address char(50),
cust_credit_limit money,
CONSTRAINT chk_id CHECK (cust_id BETWEEN 0 and 10000 )
)If the table is already created you can use
ALTER TABLE
in order to add the constraint (See the SQL Help files for how to useALTER TABLE
) Does this help?
Do you want to know more? WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums
:)thanx....:) Jijo kuruvila software developer trivandrum