📌  相关文章
📜  sql alter table add column if exists - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:53.437000             🧑  作者: Mango

代码示例1
IF NOT EXISTS (
  SELECT
    *
  FROM
    INFORMATION_SCHEMA.COLUMNS
  WHERE
    TABLE_NAME = 'table_name' AND COLUMN_NAME = 'col_name')
BEGIN
  ALTER TABLE table_name
    ADD col_name data_type NULL
END;