Originally to write a document, the middle of the program to determine whether a column exists, does not exist to add, there is no processing directly display a result can be, write the program as follows:
if exists (SELECT * FROM information_schema.columns WHERE table_name = "flow_process" and column_name = "X_test2" and TA Ble_schema = ' Td_oa ') then
ALTER TABLE flow_process add column X_test2 tinyint (1) null default 0 after X_ifmonitor;
Else
Select "Already exists";
End If;
However, the execution of the time has been prompted with errors. Exists () there is no problem with content execution within parentheses. After finding the relevant information, the original writing can only be used in the stored procedure, and requires that the MySQL version needs to be above 5.0. Then such a program can not write, only artificial to judge.
To modify the SQL statement for the MySQL data table:
Add directly to the column:
ALTER TABLE flow_process add column X_test2 tinyint (1) null;
Add columns after a column in the table:
ALTER TABLE flow_process add column X_test2 tinyint (1) null default 0 after X_ifmonitor;
Add to the first column:
ALTER TABLE flow_process add column X_test2 tinyint (1) null first;
Access OA MySQL add a column of commands to a table at a certain point in the program to judge the problem