Solved

Delete a Column in SQL Server 2000

Posted on 2004-08-23
1
355 Views
Last Modified: 2008-03-06
I am trying to write SQL code to delete a column in MS SQL Server 2000 via the SQL Query Analyzer.  For example, the following code adds a column to a table:

ALTER TABLE dbo.t_Auto
ADD BIRTH_DATE datetime null

How would I write a query to delete this field.  I thought it should look like this:

ALTER TABLE dbo.t_Auto
DELETE BIRTH_DATE datetime null

But I am getting a syntax error.  Also tried:

ALTER TABLE dbo.t_Auto
DROP BIRTH_DATE datetime null

Same syntax error.  I know this is an easy question.  Help!
0
Comment
Question by:tawalsh3
1 Comment
 
LVL 7

Accepted Solution

by:
Lori99 earned 125 total points
Comment Utility
You don't need the datatype information for a drop.

Try:

ALTER TABLE dbo.t_Auto
DROP COLUMN BIRTH_DATE
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now