I'm trying to write a procedure that having created a new database,
will then create within that new database all the tables and
procedures that go with it.
In doing this I'm hitting the problem that you can't issue a USE
command within a procedure.
So my question is either
- how do I get around this?
- if I can't, how can I create procedures etc in a *different*
(i.e. the newly created) database
or
- is there a better way to do all this (*)
I have SQL files that do this currently, but I need to edit in the
name of the database each time before execution, so I thought a
procedure would be better. Also I'd like eventually to expose some
of this functionality via a web interface.
Although I'm a newbie, I feel I'm diving in the deep end. Any good
pointers to all the issues involved in this aspect of database
management would be appreciated.
(*) One thought that occurs to me is to have a "template" database,
and to then somehow copy all procedures, tables, view etc from that.
--
HTML-to-text and markup removal with Detagger
http://www.jafsoft.com/detagger/