Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Why can't I alter this table?

Author  Topic 

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-09-15 : 12:43:06
I created this table:

CREATE TABLE [soMods] (
[fenumber] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[fsono] [char] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[frelease] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[fDateChanged] [datetime] NOT NULL ,
[fstatusOLD] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[fstatusNEW] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[forderqtyOLD] [numeric](15, 5) NULL ,
[forderqtyNEW] [numeric](15, 5) NULL ,
[funetpriceOLD] [numeric](17, 5) NULL ,
[funetpriceNEW] [numeric](17, 5) NULL ,
[PriceMod] [numeric](17, 5) NOT NULL ,
[ModType] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[FKSorelsID] [int] NOT NULL ,
[identity_column] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO


We've been using it and adding data to it. I need to alter it to have 3 more columns which I will designate as allowing Nulls. When I right click on it to get an "Alter" statement, that option is greyed out.

Why?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-15 : 12:45:19
Dont do it from management studio. just fire an ALTER TABLE [soMods] ADD... statement.Look into books online for syntax.
Go to Top of Page

james_wells
Yak Posting Veteran

55 Posts

Posted - 2008-09-15 : 17:00:15
here is an example of the syntax you need

use yourdatabasename
ALTER TABLE dbo.soMods
ADD
newfield1 [int] NOT NULL,
newfield2 [int] NOT NULL,
newfield3 [int] NOT NULL
Go to Top of Page

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-09-16 : 09:11:26
Thanks guys.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-16 : 09:23:06
If you want to do it from SSMS or EM, please make sure no window is open that references the table.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-09-16 : 09:52:50
quote:
Originally posted by Peso

If you want to do it from SSMS or EM, please make sure no window is open that references the table.



E 12°55'05.63"
N 56°04'39.26"




Stay away from the light



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -