Hi all,
I have an internal enterprise application I've developed for my company built on .Net 3.5 / SQL 2008.
I have two types of databases. The main system database which contains all of our global data, such as user names, and customers, etc. And project databases, which contain the actual data pertaining to our clients project.
When the system creates a new project for a customer, it needs to provision a new SQL database using a custom schema providing the tables, views, sps, etc. The name of the project database corresponds to the Project ID of the project stored in the system database. So a new project will create a new project database with the name: Project_XXX where XXX is the project id.
My question is what is the best way to provision a custom database programatically? Right now the only way I can think to do it is have a class which reads a SQL script from the file system and does a parse to replace the project ID for the name of the database. This is easy, but seems rather inelegant.
Any approaches some veterans out there prefer over this?