Solved

How to drop a column

Posted on 1998-12-08
3
294 Views
Last Modified: 2010-03-19
How can I drop a column in a table. "ALTER TABLE xxx DROP COLUMN yyy" is not working (i.e. Error 170; Wrong Syntax at yyy). I'm using MS-SQL 6.5 SP3 (at the very beginning).
0
Comment
Question by:mehl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
tschill120198 earned 50 total points
ID: 1092151
You can't drop a column... you need to create a second table that matches the first (without the column you want to drop), select data from the original table into the second, drop the original table, and then rename the second table (and add the indexes, FKs, etc.).
0
 

Author Comment

by:mehl
ID: 1092152
Thank you for your fast answer. Sad to see that MS SQL doesn't support DROP COLUMN (some other SQL Servers do). It's always the same with MS billshit. :-)
0
 
LVL 2

Expert Comment

by:tschill120198
ID: 1092153
Well, MS isn't the only one to not support it... Sybase and Oracle don't either.  The workaround is easy enough, and dropping a column shouldn't be that common.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question