Quantcast
Viewing latest article 6
Browse Latest Browse All 33

Answer by Valentino Vranken

I assume your table has got a column called **Gender** and its type is *char(1)*. And you're asking how to prevent incorrect values from getting inserted into that table. Correct values are M and W, all other characters are incorrect. Is that what you're asking? If it is: the application that takes care of the data insertion should contain this logic, not the database. There are methods to put it on the database side, such as by using a trigger, but in my opinion that's bad design. The application should prevent the user from even being able to enter incorrect values. One method is by showing a listbox that contains only the valid values and does not allow free text to get entered.

Viewing latest article 6
Browse Latest Browse All 33

Trending Articles