Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check constraint question
Message
De
03/08/1999 15:52:33
 
 
À
03/08/1999 14:43:23
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
00249280
Message ID:
00249400
Vues:
21
Yeah - that would work, just seems kludgey (sp?) to me. I was hoping for something more like:

CONSTRAINT alphanum_only check (ISALPHANUM(vcolumn)) with the "ISALPHANUM" being a built in funtion. Surely lots of people/cases would need this wouldn't you think?

On another note - what kind of performance hit can I expect with lots of these type checks in the database?

As for 3-T issue, seems to me that if you don't protect in the database, someone could get in and screw things up woith Excel or similar huh?

thanks!
Ken

>Ken,
>
>>How can I set a check constraint to make sure the value is alphanumeric? that is - contains nothin but 0-9 and a-z anywhere in it?
>
>Will something like this work?
>
>ALTER TABLE tablename
>ADD
>CONSTAINT alphanum_only CHECK (vcolumn LIKE REPLICATE('[0-9A-Z]', DATALENGTH(v))
>
>This seems to work best for varchar columns.
>
>>Also - in a three tier (virtual 3-T at least), is this kind of validation best handled by back end or middle tier? It seems to fall somehwere in-between RI and business rule.
>
>You could start a war with a question like this (bg). There are those people who believe that all rules should be handled by the middle tier. Then there are those people who believe that the rule should be handled at the lowest level (with the data layer being the lowest and the presentation layer the highest) that can implement it. There's probably not a right answer.
>
>-Mike
Ken B. Matson
GCom2 Solutions
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform