|
Posted by Erland Sommarskog on 02/28/07 22:25
Shiller (shillerc@gmail.com) writes:
> I want my application to create a new database/tables when run for the
> first time. I have created a stored procedure to create the new
> database named "budget". When I run the stored procedure, it creates
> the budget database but the tables are created in the "master"
> database. Please help.
This is a case where it's better to run statements from the client. After
all, somehow that stored procedure needs to be written somewhere, and I
don't think it's a good idea to write it to the master database.
Alternatively, you can put it a file that you run from OSQL or SQLCMD.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|