• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

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.
0
Richardsoet
Asked:
Richardsoet
  • 3
  • 2
1 Solution
 
rafranciscoCommented:
Try this:

ALTER TABLE NNDEBTP ALTER COLUMN NNE5CD NUMERIC(9, 2) DEFAULT '0'
0
 
RichardsoetAuthor Commented:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'DEFAULT'.

above error message when run the script
0
 
rafranciscoCommented:
ALTER TABLE NNDEBTP ALTER COLUMN NNE5CD NUMERIC(9, 2)
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
RichardsoetAuthor Commented:
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
0
 
rafranciscoCommented:
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.
0
 
Anthony PerkinsCommented:
For the record the questioner has yet to close a single question.
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.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now