Link to home
Start Free TrialLog in
Avatar of Richardsoet
Richardsoet

asked on

sql2000

trying to modify the datatype on a column on an existing table in the database , error message is below

Column names in each table must be unique. Column name 'NNE5CD' in table 'NNDEBTP' is specified more than once.

the script that i ran is below

ALTER TABLE NNDEBTP ADD  NNE5CD NUMERIC(11, 0) DEFAULT '0'

could you please rewrite the script for me to change the datatype to 9,2 instead of 11,0 specified above. each time that i ran the above script the error message i got is

Column names in each table must be unique. Column name 'NNE5CD' in table 'NNDEBTP' is specified more than once.
Avatar of rafrancisco
rafrancisco

Try this:

ALTER TABLE NNDEBTP ALTER COLUMN NNE5CD NUMERIC(9, 2) DEFAULT '0'
ASKER CERTIFIED SOLUTION
Avatar of stevetheski
stevetheski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your ADD call is trying to add an extra column. Use the ALTER function to change the properties of an existing column. Give the points to raf.

Cheers
SFH
I say if Raf's method works then give him the points
however,  I have never been able to
execute a 1 liner with alter like that.

I get the following
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'DEFAULT'.