0
How to write an SQL query which would check the length of an integer field?
I am making a table with a column named Phone number (having INT data type) and I want that this field always checks whether or not the value inserted in it, is of 10 digits. How do I accomplish that? Any help would be appreciated.
4 Answers
0
Optimus Prime Use LEN() function.
SELECT LEN("Hello");
Output : 5
0
This i am asking for SQL sir. Length() is the name of the function in SQL but I am not getting how to get the value checked using the CHECK constraint.
0
What date-type are you using for the phones number column, I don't want to assume it's a 'text' (or what ever the equivalent is in mysql)?
0
It is int data type.