Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old October 7th, 2008, 08:50 AM
Member
 
Join Date: Nov 2007
Posts: 112
Default Constraint - check integer string

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

IsNumeric() is a function.

Try

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

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles