Get the App
SLTechnology News&Howtos  ›  Database  › 

How to delete multi-column statements in SQL

Shulou Source: shulou.com Published: 2022-06-01 04:23:10 10月02日 Update

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!

Tags: Conjecture writing statement structure at the same time way question first time website grammar procedure error help support adjustment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Huawei Apple Linux Shulou Technology