Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check Constraint
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
00620352
Message ID:
00620357
Vues:
10
>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]')
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform