[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sql2k

Posted on 2005-05-09
7
Medium Priority
?
228 Views
Last Modified: 2010-03-19
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
Comment
Question by:Richardsoet
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13963789
Try this:

ALTER TABLE NNDEBTP ALTER COLUMN NNE5CD NUMERIC(9, 2) DEFAULT '0'
0
 

Author Comment

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

above error message when run the script
0
 
LVL 28

Accepted Solution

by:
rafrancisco earned 2000 total points
ID: 13963816
ALTER TABLE NNDEBTP ALTER COLUMN NNE5CD NUMERIC(9, 2)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Richardsoet
ID: 13963882
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
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13963935
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 13963956
For the record the questioner has yet to close a single question.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question