I´m new to sql server so maybe this is a really easy one...
I´m developing a VB app and have a server on which I need to dynamically create multiple databases. This is not a problem, I can do that in Transact-SQL.
The problem is that I need to create a set of sp:s, tables and views in the new databases from a template. First I created these objects in the model db so they were always copied to the new db, but since the server will be used for other db:s as well I have to abandon this approach.
I have an "admin" db which creates the new db:s, but I haven´t managed to run the .sql script from an sp in that db (I tried to use the "USE" statement, which is not allowed)
So what I pretty much would like to do is to somehow execute a generated .sql file in the new db:s. Do you know to do it? Or another solution?
/gny
I´m developing a VB app and have a server on which I need to dynamically create multiple databases. This is not a problem, I can do that in Transact-SQL.
The problem is that I need to create a set of sp:s, tables and views in the new databases from a template. First I created these objects in the model db so they were always copied to the new db, but since the server will be used for other db:s as well I have to abandon this approach.
I have an "admin" db which creates the new db:s, but I haven´t managed to run the .sql script from an sp in that db (I tried to use the "USE" statement, which is not allowed)
So what I pretty much would like to do is to somehow execute a generated .sql file in the new db:s. Do you know to do it? Or another solution?
/gny