-1

i want to accept only alphabetic value

1 Answers1

0

Using constraint to accept only alphabetic values :

ALTER TABLE table_name ADD CONSTRAINT column_alpha_check
CHECK
(
  Column_Name like '%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]%'
)
jarlh
  • 42,561
  • 8
  • 45
  • 63
Mansoor
  • 4,061
  • 1
  • 17
  • 27
  • There may be problems with check constraint see http://stackoverflow.com/questions/34132644/sql-check-constraint-not-working-properly, http://stackoverflow.com/questions/2115497/check-constraint-in-mysql-is-not-working. I note that mariadb 10.2.1 supposedly does support check constraints. Don't know about mysql. – P.Salmon Feb 21 '17 at 10:06