Deleting a column from a table

Deleting a column from a table

Post by Nabeel Moee » Thu, 28 Feb 2002 19:46:45



i need to the syntax for dropping a column from a table.
Thanx
 
 
 

Deleting a column from a table

Post by Uri Diman » Thu, 28 Feb 2002 19:57:09



Quote:> i need to the syntax for dropping a column from a table.
> Thanx


 
 
 

Deleting a column from a table

Post by Trevor Dwye » Thu, 28 Feb 2002 20:00:43


There is no actual command to do this - however if you use enterprise
Manager to remove the column and then click on the script icon you can see
what actually takes place when you do remove the column. You can then cut
and paste this sql into Query Analyzer.

Best Regards

Trevor Dwyer - SQL Server MVP


Quote:> i need to the syntax for dropping a column from a table.
> Thanx

 
 
 

Deleting a column from a table

Post by Tony Rogerso » Thu, 28 Feb 2002 20:07:39


7.0 and 2000

ALTER TABLE .... DROP COLUMN ...

--
Tony Rogerson SQL Server MVP
Torver Computer Consultants Ltd
http://www.sql-server.co.uk [UK User Group, FAQ, KB's etc..]


Quote:> i need to the syntax for dropping a column from a table.
> Thanx

 
 
 

Deleting a column from a table

Post by Olha Makasyeyev » Thu, 28 Feb 2002 20:43:51


Hi Nabeel,

If the column you want to drop has an index defined on it
you have to drop the index  before dropping
column:

sp_helpindex TableAA
DROP INDEX TableAA.IX_TableAA

If the column you want to drop is a foreign key
you have to drop the foreign key constraint before dropping
column:

ALTER TABLE <tableName>
DROP CONSTRAINT  <constraintNAme>

With regards,

Olha Makasyeyeva,
MCDBA, MCSD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

Deleting a column from a table

Post by Trevor Dwye » Fri, 08 Mar 2002 20:34:00


Reading this back to myself - of course there is a command - I am not sure
what I was thinking here :)

Trevor


> There is no actual command to do this - however if you use enterprise
> Manager to remove the column and then click on the script icon you can see
> what actually takes place when you do remove the column. You can then cut
> and paste this sql into Query Analyzer.

> Best Regards

> Trevor Dwyer - SQL Server MVP



> > i need to the syntax for dropping a column from a table.
> > Thanx

 
 
 

Deleting a column from a table

Post by BP Margoli » Sat, 09 Mar 2002 00:08:00


Trevor,

Always knew that sex, * and/or rock 'n' roll would get to you one day
:-)

BPM


> Reading this back to myself - of course there is a command - I am not sure
> what I was thinking here :)

> Trevor



> > There is no actual command to do this - however if you use enterprise
> > Manager to remove the column and then click on the script icon you can
see
> > what actually takes place when you do remove the column. You can then
cut
> > and paste this sql into Query Analyzer.

> > Best Regards

> > Trevor Dwyer - SQL Server MVP



> > > i need to the syntax for dropping a column from a table.
> > > Thanx

 
 
 

1. mess delete common column in all tables

Hi,

I have a common column exists in all my tables and now I don't need this
column any more. Is there a way to mess delete the column in all tables,
instead of openning each individual table and delete it. I have about 500
tables.

Thanks for the advise.

2. NATIONWIDE AUCTION SYSTEMS NEEDS DEVELOPERS

3. Deleting a column from a table

4. FPW2.6 Report Question

5. Deleting a Column from a Table

6. US-FL-West Palm Beach:: Recruiter Needs --Sybase DBA

7. How to delete a column in a table?

8. Copying from SQL7 to SQL2k???

9. Deleting a Column from a Table via SQL

10. Can I delete a column in a table?

11. delete a column from a table.

12. Help deleting/adding columns to MDB tables

13. Deleting a Column from a Table via DAO