By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,575 Members | 1,968 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,575 IT Pros & Developers. It's quick & easy.

Constraint - check integer string

P: 144

i have a field named 'nim', in my table which is a char(10) field.

i want to create a constraint that checks the field so the field must be 10 characters long and each character is a number.

i can only think of nim like '[0-9][0-9][0-9] .... [0-9]' . i can't use isnumeric() because it may still accept dot character right? anyway i've tried to use the isnumeric function but i get this " error Incorrect syntax near ')' ".

i don't know what's wrong with this line
Expand|Select|Wrap|Line Numbers
  1. CONSTRAINT checkNIM CHECK ( len(nim)=10 and isnumeric(nim) )

thank you very much.
Oct 7 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 2,878
IsNumeric() is a function.


Expand|Select|Wrap|Line Numbers
  1. isnumeric(nim) = 1
-- CK
Oct 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.