Create script for new Database using API
flemingho
Posts: 10
Hi,
Is there an API code example that I can use, to create a script for a new database (ie. non-upgrade script).
Basically I have a starting database (internally) where our customers can create new databases from. So, I'm hoping I can use the API to generate a script which I can deploy and execute on the client side that will create the same database structure (with initial records), under different database names.
I can't use the template packager because I writing my own custom utility that will be executed on the customer site, as it includes other operations that I require.
Thanks
Fleming
Is there an API code example that I can use, to create a script for a new database (ie. non-upgrade script).
Basically I have a starting database (internally) where our customers can create new databases from. So, I'm hoping I can use the API to generate a script which I can deploy and execute on the client side that will create the same database structure (with initial records), under different database names.
I can't use the template packager because I writing my own custom utility that will be executed on the customer site, as it includes other operations that I require.
Thanks
Fleming
Comments
In code, you can register one database using Database.Register, then leave the second database as a new, blank database object. Then compare the two to generate a synchronization script. You would still need to append the CREATE DATABASE... command to the top of the script but that's not hard to do at all!
Just as a suggestion, but this would be a good code example that needs an appropriate section title/name for itself in the next version of SQLBundle.
Or the CompareWith method needs to have the use of "null" documented.
Thanks, again.
I had asked this question in version 4 where you gave me a code snippet that worked like a charm. I'm trying to convert the same utility using version 5, but there seems to be some changes in the API that has "obseleted" some functions e.g. SQLProvider.GetDatabase().
I was wondering if you could be so kind again to give me a code snippet that does the same thing, please. The help file in version 5 is a tad less detailed than version 4.
Thanks,
Fleming