Posted By

pauliehaha on 02/09/09


Tagged


Versions (?)

Check Column Exists And Add


 / Published in: SQL
 

  1. -- Check Column exists in table, if not, add
  2. IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
  3. WHERE TABLE_NAME = ‘TEST’ AND COLUMN_NAME = ‘TEST_DATE’)
  4. BEGIN
  5. -- ALTER TABLE TEST ADD TEST_DATE DATETIME
  6. END

Report this snippet  

You need to login to post a comment.