I want to delete specific values/data from one column with the WHERE condition. Putting in another way, I don't want to delete the complete row. Is it possible?
Asked
Active
Viewed 2.5e+01k times
37
-
1Please include a sample what you have got now. – Patrick Hofman Jan 29 '14 at 09:02
5 Answers
27
-
If you post code, XML or data samples, **please** highlight those lines in the text editor and click on the "code samples" button ( { } ) on the editor toolbar to nicely format and syntax highlight it! – marc_s Jan 19 '11 at 08:10
19
You don't want to delete if you're wanting to leave the row itself intact. You want to update the row, and change the column value.
The general form for this would be an UPDATE
statement:
UPDATE <table name>
SET
ColumnA = <NULL, or '', or whatever else is suitable for the new value for the column>
WHERE
ColumnA = <bad value> /* or any other search conditions */

Damien_The_Unbeliever
- 234,701
- 27
- 340
- 448
6
You can also use REPLACE()
:
UPDATE Table
SET Column = REPLACE(Column, 'Test123', 'Test')

Mike
- 14,010
- 29
- 101
- 161

Nathan Holmes
- 105
- 2
- 12
1
Try this SQL statement:
update Table set Column =( Column - your val )

Shankar Ganesh Jayaraman
- 1,401
- 1
- 16
- 22

haytham fathy
- 11
- 1