• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

How to drop a column

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
mehl
Asked:
mehl
  • 2
1 Solution
 
tschill120198Commented:
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
 
mehlAuthor Commented:
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
 
tschill120198Commented:
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

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now