Home > Software design >  deleting entire column contents on sql database
deleting entire column contents on sql database

Time:09-27

I have a large table on an sql database and I'd like to delete the entire contents of one of the columns, What is the best practice to do that? looping over the records and set them to null would is very slow.

CodePudding user response:

Select [all columns except the on you don't want] INTO newtable FROM TABLE_1;

DROP TABLE TABLE_1; \rename the "newtable" to "TABLE_1";

CodePudding user response:

UPDATE table SET column = NULL

  • Related