sql alter table add column if exists

Solutions on MaxInterview for sql alter table add column if exists by the best coders in the world

showing results for - "sql alter table add column if exists"
Arianna
01 Oct 2018
1IF NOT EXISTS (
2  SELECT
3    *
4  FROM
5    INFORMATION_SCHEMA.COLUMNS
6  WHERE
7    TABLE_NAME = 'table_name' AND COLUMN_NAME = 'col_name')
8BEGIN
9  ALTER TABLE table_name
10    ADD col_name data_type NULL
11END;
12