Skip to content

Instantly share code, notes, and snippets.

@clintmjohnson
Last active August 29, 2015 14:20
Show Gist options
  • Save clintmjohnson/cb24aecdad43a38428ec to your computer and use it in GitHub Desktop.
Save clintmjohnson/cb24aecdad43a38428ec to your computer and use it in GitHub Desktop.
This SQL Query converts a Phone Number Like this '1234567891' into this '123-456-7891'
SELECT
SUBSTRING([Customer Phone], 1, 3) + '-' + SUBSTRING([Customer Phone], 4, 3) + '-' +SUBSTRING([Customer Phone], 7, 4)
FROM tablename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment