Hey Site Point,
I've built a tool that compares the tables and the table structure between two databases. I have managed to get the tool to the point where it will detect the differences of one table against another and now I'm trying to put the icing on the cake by making the tool also generate the SQL code to correct the difference. The two kinds of differences I'm having trouble with is the adding of a missing column and the altering of an existing one. I've googled for a while now and I'm confused as to what exactly I need to do as every example I've found has different syntaxes to add/alter columns. So what I would like to know is in which order do I put the following column attributes.
Field, Type, Null, Key, Default, Extra
I know the syntax is something like "alter table table_name add column Field, Not Null, Key, Default =, extra stuff here etc" but for the life of me I can't seem to figure it out. If you wouldn't mind throwing me a bone here I'd really appreciate it.