I am using Microsoft SQL Server with already stored data. In one of my tables I can find data like:
+--------+------------+
| id | value |
+--------+------------+
| 1 | 12-34 |
| 2 | 5678 |
| 3 | 1-23-4 |
+--------+------------+
I realized that the VALUE column was not properly formatted when inserted. What I am trying to achieve is to get id by given value:
SELECT d.id FROM data d WHERE d.value = '1234';
Is there any way to format data in column just before SELECT clause? Should I create new view and modify column in that view or maybe use complicated REGEX to get only digits (with LIKE comparator)?
- P.S. I manage database in Jakarta EE project using Hibernate.
- P.S.2. I am not able to modify stored data.