devxlogo

Displaying Retrieved Text in a Certain Manner

Displaying Retrieved Text in a Certain Manner

Question:
When char data is retrieved, is there a way to display it in a certain way? An example would be a phone number. If the phone number data is nothing but a string of numbers, is there a way to tell the query to output it as 123-456-7890 instead of 1234567890?

Answer:
Yes you can. Two things come to mind: one is to create a rule on the column that enforces the pattern you want; the other is to give the illusion of those marks by planting them in your SQL statement so that the result comes back with the embedded dashes, etc.

devx-admin

Share the Post: