Connecting Tech Pros Worldwide Help | Site Map

Constraint - check integer string

  #1  
Old October 7th, 2008, 08:50 AM
Member
 
Join Date: Nov 2007
Posts: 125
hi,

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.
  #2  
Old October 7th, 2008, 10:26 AM
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,914
Provided Answers: 1

re: Constraint - check integer string


IsNumeric() is a function.

Try

Expand|Select|Wrap|Line Numbers
  1. isnumeric(nim) = 1
-- CK
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vaporware C99 preprocessor: string literal corner cases zaimoni@zaimoni.com answers 4 November 5th, 2008 10:15 PM
'New' cannot be used on a type parameter that does not have a 'New' constraint Siegfried Heintze answers 5 January 13th, 2008 07:05 PM
constraint not declared Bart V answers 1 November 12th, 2005 03:15 AM
constraint not declared Bart V answers 3 July 20th, 2005 08:14 AM
1-multiple to string Yannick Turgeon answers 4 July 20th, 2005 04:46 AM