Syntax error when changing field size using ALTER TABLE

S

strict9

Hello,

I am trying to use the following line to change a zip code field from
10 to 5 digits:

db.Execute "ALTER TABLE [Master] ALTER COLUMN [MailZip] NUMBER(5)"

However, it gives me the error "Sytax error in ALTER TABLE statement."
If I remove the (5) it works just fine. Any ideas?
 
S

strict9

Ah, and therein lies my confusion. Looks like just using TEXT(5) is
easier the. Thanks for the quick response!
 
B

Brendan Reynolds

Yes, a text field is generally the best choice for a field that will contain
something like a ZIP code or a phone number, e.g. it is made up of digits,
but you don't need to perform any kind of numeric operation on it. It will
also make life easier if you ever need to record non-US postal codes, which
include letters as well as digits.

Not sure about the five digits, though - I live in Ireland, so I'm no expert
on US ZIP codes, but I thought some of them were longer than that now?
 
J

John Spencer

Just FYI for Brendon.

US ZipCodes are 5 numeric characters; however, for increased definition you
can add 4 more numeric characters. The US Post Office would prefer that you
use Zip plus 4, but most people use just the first five. I believe that
large organizations tend to use the Zip plus 4 to get a discount on the
postage rate.

For instance, my ZIP is 21045-2603. Almost all my mail uses 21045.

John
 
B

Brendan Reynolds

Thanks John.

--
Brendan Reynolds

John Spencer said:
Just FYI for Brendon.

US ZipCodes are 5 numeric characters; however, for increased definition
you can add 4 more numeric characters. The US Post Office would prefer
that you use Zip plus 4, but most people use just the first five. I
believe that large organizations tend to use the Zip plus 4 to get a
discount on the postage rate.

For instance, my ZIP is 21045-2603. Almost all my mail uses 21045.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top