Over a million developers have joined DZone.

SQL -> Check Column Exists In Table, If Not, Add

· Database Zone

Speed up your development and test cycles with fully automated data delivery, view a 10 minute demo, brought to you in partnership with Delphix.


IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = ‘TEST’ AND COLUMN_NAME = ‘TEST_DATE’)
BEGIN
   ALTER TABLE TEST ADD TEST_DATE DATETIME
END


Learn how test data on demand can lead to faster application development, read the IDC white paper, brought to you in partnership with Delphix.

Topics:
database,sql

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}