Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check Constraint
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
00620352
Message ID:
00620357
Views:
11
>Anyone have an idea on how i can create a column check constraint on a char(15) column that only allows the digits 0-9 and the characters A-F?
>
>In fox pro I did this...
>
>
>FOR i=1 TO LEN(ALLT(THISFORM.txtnic.VALUE))
>   IF !INLIST(SUBSTR(ALLT(THISFORM.txtnic.VALUE),i,1), '1','2','3','4','5','6','7','8','9','0','A','B','C','D','E','F')
>      warningmessage=warningmessage+CHR(13)+'Invalid NIC address. (Non hex digit)'+' "'+SUBSTR(ALLT(THISFORM.txtnic.VALUE),i,1)+'"'
>       THISFORM.txtnic.SETFOCUS
>       oktosave=.F.
>   ENDIF
>ENDFOR
>
>
>but im not sure if you can loop through each character. Any help is appreciated.
>
>Eric Stephani


Well, for anyone who cares, I figured it out... here is the solution i got. I dug up some examples in the BOL and figured it out.

([physical] like '[0-9 A-F][0-9 A-F][0-9 A-F][0-9 A-F][[0-9 A-F][0-9 A-F][0-9 A-F][0-9 A-F][0-9 A-F][0-9 A-F][0-9 A-F][0-9 A-F]')
Previous
Reply
Map
View

Click here to load this message in the networking platform