How to delete multi-column statements in SQL
Recently, in the process of writing SQL, I found that I need to adjust the structure of a table (here is SQL Server), in which multiple columns need to be deleted. Since the previous SQL statement deleted a column, I wondered if it was possible to delete multiple columns with one statement at the same time. If so, how to write it?
The first conjecture is as follows (note: here is the conjecture, incorrect writing):
ALTER TABLE TableName DROP COLUMN column1,column2
But after execution, a syntax error was found, so it was changed to the following way:
ALTER TABLE TableName DROP COLUMN column1,COLUMN column2
Execute correctly, then look at the table structure and find that the column has been deleted, which proves that the conjecture is correct.
The above is the editor introduced to you SQL delete multi-column sentence writing, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!