SQL update statement based on a formula?

in my table PostalCodes i need to select all Postalcodes from dbo.postalcodes where LEN = 4, and then add a leading 0 (zero) in front of value and re-update it.

For example, postal codes in the table that look like this:  7712  should actually be 07712

Anyone know how to do this?
arthurh88Asked:
Who is Participating?
 
Kyle AbrahamsSenior .Net DeveloperCommented:
update postalcodes
set postalcode = '0' + postalcode
where len(postalcode) = 4
0
 
arthurh88Author Commented:
bah!  i should have figured this one out :)  Thanks!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.