Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

SQL -> Check Column exists in table, if not, add

// Check to see if column exists and then create if not

   1  
   2  IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
   3  WHERE TABLE_NAME =TESTAND COLUMN_NAME =TEST_DATE’)
   4  BEGIN
   5     ALTER TABLE TEST ADD TEST_DATE DATETIME
   6  END

Check whether table exists

Checks whether mysql table exists.

   1  
   2  SHOW TABLES LIKE 'table_name'
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS