Link to home
Start Free TrialLog in
Avatar of Richardsoet
Richardsoet

asked on

sql2k

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'
Avatar of Richardsoet

ASKER

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

above error message when run the script
ASKER CERTIFIED SOLUTION
Avatar of rafrancisco
rafrancisco

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
error mesg

Server: Msg 5074, Level 16, State 8, Line 1
The object 'NNDEBTP_PK' is dependent on column 'NNE5CD'.
Server: Msg 5074, Level 16, State 1, Line 1
The index 'NNDEBTL2_IX' is dependent on column 'NNE5CD'.
Server: Msg 5074, Level 16, State 1, Line 1
The index 'NNDEBTL7_IX' is dependent on column 'NNE5CD'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE ALTER COLUMN NNE5CD failed because one or more objects access this column.


do i need to drop those or what
Looks like your column has a lot of dependencies.  Have you tried modifying your column using Enterprise Manager?

Before you drop the indexes, make sure you take note of its definition.
Avatar of Anthony Perkins
For the record the questioner has yet to close a single question.