Question:
can we delete Only information from a column in SQL?
Ganesh B
2008-10-27 01:59:57 UTC
if yes, plz tell me that query........
Six answers:
planetmatt
2008-10-27 02:24:53 UTC
UPDATE TableName SET ColumnName = NULL



If you are deleting the column values from every record then you do not need a where clause.
poe
2016-10-31 07:33:51 UTC
Sql Delete Column Data
TheMadProfessor
2008-10-27 05:52:09 UTC
Besides the UPDATE query already mentioned, it may be possible (depending on your DBMS) to remove the column altogether. However, this is usually a 2 or more step process:



1) If there is an index that includes the column in question, use DROP INDEX to delete it.

2) If the column currently defined as NOT NULL, use ALTER TABLE to make nullable.

3) Use UPDATE as mentioned already to null the values.

4) USE ALTER TABLE to drop the column.
Sleeping Troll
2008-10-27 02:13:57 UTC
I assume you want to delete all values in a column for all records in a table,



SQL="Update (TABLE) Set (COLUMN) = '' Where (COLUMN)= '*'";

or

SQL="Update (TABLE) Set (COLUMN) = null Where (COLUMN)= '*'";
anonymous
2016-03-13 06:35:48 UTC
You could create the new table and then SELECT...INTO any existing data in the old one into the new table. Otherwise you could try ALTER TABLE tablename ADD columnname columntype For example: ALTER TABLE pets ADD owner varchar(30) To delete an entire table along with its data and indexes, you can use DROP TABLE tablename Hope this helps!
sivraj
2008-10-27 02:05:06 UTC
are you trying to delete a certain record from a certain column? if so, look for a google tutorial about deleting records


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...