DB2 - Exemplos simples - DROP COLUMN



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

DB2 - Exemplos simples - DROP COLUMN

Sometimes, you may want to delete one or more unused columns from a table.
To do this, you use the ALTER TABLE DROP COLUMN statement as follows:

Às vezes, você pode querer excluir uma ou mais colunas não utilizadas de uma tabela.
Para fazer isso, você usa a ALTER TABLE DROP COLUMNinstrução da seguinte maneira:

    ALTER TABLE table_name
          DROP COLUMN column_name;

In this syntax:

  • First, specify the name of the table from which you want to drop the column in the ALTER TABLE clause.
  • Second, specify the name of the column that you want to delete in the DROP COLUMN clause.

Nesta sintaxe:

  • Primeiro, especifique o nome da tabela da qual você deseja eliminar a coluna na cláusula ALTER TABLE.
  • Em segundo lugar, especifique o nome da coluna que você deseja excluir na cláusula DROP COLUMN.

To delete multiple columns, you can use the following syntax:
Para excluir várias colunas, você pode usar a seguinte sintaxe:

    ALTER TABLE table_name
          DROP COLUMN column_name_1
          DROP COLUMN column_name_2
          ...;

The following SQL deletes the "ContactName" column from the "Customers" table:
O seguinte SQL exclui a coluna "ContactName" da tabela "Customers":

    ALTER TABLE Customers
          DROP COLUMN ContactName;