[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]


    Search the Q&A Archives


TER TABLE ALTER COLUMN failed because one or more objects...

<< Back to: OpenVMS Frequently Asked Questions (FAQ), Part 1/5

Question by Ganesan P
Submitted on 6/9/2004
Related FAQ: OpenVMS Frequently Asked Questions (FAQ), Part 1/5
Rating: Rate this question: Vote
TER TABLE ALTER COLUMN failed because one or more objects access this column.



Answer by piolo
Submitted on 11/3/2004
Rating: Not yet rated Rate this answer: Vote
piolox

 

Answer by srikanthvja
Submitted on 3/19/2007
Rating: Not yet rated Rate this answer: Vote
--Example schema as follows
---------------------------
CREATE TABLE [MappingsChannel] (
   [ProductID] [int] NOT NULL ,
   [Channel] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
   CONSTRAINT [PK_MappingsChannel] PRIMARY KEY  CLUSTERED
   (
      [ProductID],
      [Channel]
   ) WITH  FILLFACTOR = 100  ON [PRIMARY]
) ON [PRIMARY]
GO



--Test Case :error in way of alter column size which involved in primary key
------------------------------------------------------
ALTER TABLE dbname.dbo.MappingsChannel
ALTER COLUMN Channel VARCHAR(50)

-- you will get following error message
--------------------------------------------------------------------------------------
Server: Msg 5074, Level 16, State 8, Line 1
The object 'PK_MappingsChannel' is dependent on column 'Channel'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE ALTER COLUMN Channel failed because one or more objects access this column.



-- Correct way to handle this situation is, include not null constraint as follows as this
-- column involved in primary key.
----------------------------------------------------------------------------------------
ALTER TABLE dbname.dbo.MappingsChannel
ALTER COLUMN Channel VARCHAR(50) not null


Comments from Srikanthvja
I will be happy if this Test Case and my Time helps to at least one person in the world.
All the Best to my dear global friend i.e Nothing but you.

 

Your answer will be published for anyone to see and rate.  Your answer will not be displayed immediately.  If you'd like to get expert points and benefit from positive ratings, please create a new account or login into an existing account below.


Your name or nickname:
If you'd like to create a new account or access your existing account, put in your password here:
Your answer:

FAQS.ORG reserves the right to edit your answer as to improve its clarity.  By submitting your answer you authorize FAQS.ORG to publish your answer on the WWW without any restrictions. You agree to hold harmless and indemnify FAQS.ORG against any claims, costs, or damages resulting from publishing your answer.

 

FAQS.ORG makes no guarantees as to the accuracy of the posts. Each post is the personal opinion of the poster. These posts are not intended to substitute for medical, tax, legal, investment, accounting, or other professional advice. FAQS.ORG does not endorse any opinion or any product or service mentioned mentioned in these posts.

 

<< Back to: OpenVMS Frequently Asked Questions (FAQ), Part 1/5


[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

© 2008 FAQS.ORG. All rights reserved.