Hey all,

I've got a question for you. What would be the best way to set up a set of 
srcipts to create\Update the databse when my app is installed?

The problem is that I obviously can't just drop the database cause if the 
database is already installed then the client would lose all his data. I need a 
way to update the collumns in each table if they change but still keep the 
clients data. Stored Procedures, Views and Triggers are easy cause these I can 
drop then create again but tables are a bit more complex.

I thought of  writing something to the effect of :
 
USE Information_Schema;

IF (SELECT Table_Name FROM Tables WHERE TableName = '<TableName>' AND 
Table_Schema = '<Database>') IS NULL THEN
    BEGIN
        {Create Table}
    END;
ELSE
    BEGIN
        {Alter Table}
    END;
END IF;

Is there not a better way of doing things? We want to try and create\update the 
database through scripts which can then be deleted instead of writing an app. 

Any help would be greatly appreciated

Thanx,
Luke

Reply via email to