I have a SQL Server table with one column that stores Canadian Postal Codes. Sometimes they’re in the proper format H0H 0H0, and othertimes they’re written like H0H0H0 or H0H-0H0. I’m looking to be able to update all records to standardize the format as H0H 0H0 but I cannot figure out the SQL. Any help would be appreciated.
Share
This assumes that the postal code field has already been trimmed on both the left and right sides. It literally grabs the left 3 digits, places a space and then the right 3 digits.