Rob099
asked on
SQL server managment studio, how to clear data from one column only
SQL server managment studio, how to clear data from one column only. I manage my database tables on my server with SQL server managment studio. I need to clear the data from a column without deleting that column. I'm a novice with databases and this SQL server managment studio.
Above will work if the column is text, but it would be better to ensure that the field allows nulls (set this in management studio) and then set the column to null:
UPDATE your_table SET your_field = null
UPDATE your_table SET your_field = null
ASKER
Can I also add another instruction to the query to apply that clear column only from rows 25 to 75.
-- Add where condition
UPDATE your_table SET your_field = '' WHERE your_field_id between 25 and 75
--Assuming your_field_id is the primary key column as integer and contains sequential numbers.
UPDATE your_table SET your_field = '' WHERE your_field_id between 25 and 75
--Assuming your_field_id is the primary key column as integer and contains sequential numbers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I meant updated, not deleted, of course...
UPDATE your_table SET your_field = ''
This will set all the data in your_field as blank.