Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Updating Zip Codes

Author  Topic 

JessicaRivas
Starting Member

2 Posts

Posted - 2012-03-06 : 21:44:44
Hello,
I am new to writing syntax - I really need help. All I need to do is append the following to all my address zip codes

-9999

I want all zip codes that are less than 9 characters to be appended with a -9999 which make the zip code 9char in lenght.

Thank you so much for your help.

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-06 : 22:18:13
well do you mean exactly 5?

UPDATE Table SET Col = Col + '-9999'
WHERE LEN(Col) = 5

???

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

JessicaRivas
Starting Member

2 Posts

Posted - 2012-03-07 : 22:00:24
Thank you, this worked perfectly! I am new to this forum, it's great to get help :-)
Go to Top of Page
   

- Advertisement -