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
 Drop multiple columns

Author  Topic 

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-03-16 : 15:47:52
I have a bunch of extraneous columns that i need to get rid of in some tables. My assumption is that i have to issue an ALTER TABLE line for each column in want gone, but i'm not finding adequate information on the syntax needed.

ALTER TABLE douglasconversion.dbo.mni ALTER COLUMN DROP......

From there it looks like there are options for ROWGUIDCOL, PERSISTED, NOT FOR REPLICATION. Are any of these necessary or do i just provide the column name with it's params after DROP?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-16 : 15:50:23
it should be



ALTER TABLE douglasconversion.dbo.mni DROP COLUMN columnname


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-03-17 : 14:37:21
You can drop multiple columns with single alter statement



ALTER TABLE douglasconversion.dbo.mni DROP COLUMN columnname1,columnname2,columnname3



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -