I have a table of cities where I have zip codes.
The data looks like this: 89620000
I would like to leave them like this: 89620-000
How can I do this in Firebird?
I have a table of cities where I have zip codes.
The data looks like this: 89620000
I would like to leave them like this: 89620-000
How can I do this in Firebird?
You did not give too many details but I think this will solve:
UPDATE cidades SET cep = SUBSTRING(cep FROM 1 FOR 5) || "-" || SUBSTRING(cep FROM 6 FOR 8);
If the column was 8 characters in length you will have to increase it beforehand.
Know that the most common is not to store pendants in the data. In general the application or even specific queries should treat the pure data and place the hyphen when necessary. Of course there are cases everything store may be needed, it may be your case.