alter column

From: baramee (bkunnika_at_hotmail.com)
Date: 05/13/04


Date: Thu, 13 May 2004 07:50:55 +0700

I want to alter column that it's part of primary key.
I tried to use script as follow.

    ALTER TABLE table1 ALTER COLUMN column1 varchar(30)

Before i run this script, it generate error.

Server: Msg 5074, Level 16, State 8, Line 1
The object 'PK_table1' is dependent on column 'column1'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE ALTER COLUMN mobile_number failed because one or more objects
access this column.

                        Everyon help me please
                            Thanks in advance.



Relevant Pages

  • Re: checking the type of a column
    ... Query Analyzer you generate some script? ... They use sysobjects directly... ... >> of maintenance, performance, etc.)? ... >> I want to make an ALTER COLUMN to change a column's type (say VARCHAR to ...
    (microsoft.public.sqlserver.programming)
  • Re: ALTER TABLE: recreate columns
    ... change script" toolbar button. ... Enterprise Manager does not always do things efficiently - most of it ... >"Specifies whether the column can accept null values. ... >specified in ALTER COLUMN only if the column contains no null values. ...
    (microsoft.public.sqlserver.programming)
  • ALTER COLUMN to for INDENTIY?
    ... Is it possible to ALTER COLUMN to convert a column into an IDENTIY column, ... from a script? ... (I know you can do this from Enterprise Manager - that doesn't help) ...
    (microsoft.public.sqlserver.programming)
  • Re: ALTER IDENTITY setting...
    ... Enterprise manager will create a new table and drop the old one. ... it to generate the script to do this. ... > I just need to alter column with Identity. ... >> rename the new one). ...
    (microsoft.public.sqlserver.programming)
  • drop primary and foreign key in sql server 2000
    ... Latin1_General_CI_AS using a stored procedure for it will have to execute at ... The object 'FK_tblLimits_tblSequences' is dependent on column 'Seq_ID'. ... ALTER TABLE ALTER COLUMN Seq_ID failed because one or more objects access ... Worst from what I have been reading it appears that it can not be done. ...
    (microsoft.public.sqlserver.programming)