I am creating a check constraint on a field (GRID_NBR) for values between 1 & 99. I am a little confused on creating the expression for it (Books online is vague).
Can I use the following expression: GRID_NBR BETWEEN 1 AND 99
Or do I have to use: GRID_NBR > 0 AND GRID_NBR < 100
Thanks!I am creating a check constraint on a field (GRID_NBR) for values between 1 & 99. I am a little confused on creating the expression for it (Books online is vague).
Can I use the following expression: GRID_NBR BETWEEN 1 AND 99
Or do I have to use: GRID_NBR > 0 AND GRID_NBR < 100
Thanks!
I found my own answer (in Books Online)...here's the example it gave on the Constraint page...
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 )
)
Showing posts with label books. Show all posts
Showing posts with label books. Show all posts
Thursday, March 22, 2012
on Check Constraint expressions
Labels:
books,
constraint,
creating,
database,
expression,
expressions,
field,
grid_nbr,
microsoft,
mysql,
oracle,
server,
sql,
values
Tuesday, March 20, 2012
::Info Request::
Please suggest good books for SQL Server 2005
Thx MuchGoto http://mspress.microsoft.com and do a search for "SQL 2005"
Peace & happy computing,
Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
Thx MuchGoto http://mspress.microsoft.com and do a search for "SQL 2005"
Peace & happy computing,
Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
Subscribe to:
Posts (Atom)