So I've found that I can use SELECT LOCATE(1,"TEST1")
; and it returns 5 correctly.
What I want to do though is add this as a constraint to my table, so TEST1 will be changing and the goal is to check that the 5th position is always a number. This works, but I was wondering whether there is a much easier method to add in 0 until 9 without having to write this line 10 times.
Right now my constraint looks like this :
ALTER TABLE Accommodatie
ADD CONSTRAINT acode_checker
CHECK (LENGTH(accommodatie_code) = 5);
So now I have to add the check for the 5th position, any tips?