Updating Field to a new format

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Is it possible to take a field, in my case Social security number. And tell
it to put in the hyphen where there is not one in the already present date
000112222 to 000-11-2222 ?
Any ideas would be appreciated
 
For display purposes you could just use the format function

Format(SSN,"@@@-@@-@@@@")

If you have some fields with the dashes and some without dashes and want to
update PERMANENTLY the latter.

UPDATE YourTable
SET SSN = Format(SSN,"@@@-@@-@@@@")
WHERE LEN(SSN) = 9 AND SSN NOT Like "*-*-*"
 
Back
Top