| 
	
 | 
 Posted by Shiller on 02/28/07 17:52 
On Feb 28, 12:10 pm, "AlterEgo" <altereg...@dslextreme.com> wrote: 
> Shiller, 
> 
> Use a three part qualifier in your create table statement: 
> 
> create table MyDB.dbo.MyTable ... 
> 
> -- Bill 
> 
> "Greg D. Moore (Strider)" <mooregr_deletet...@greenms.com> wrote in messagenews:K_hFh.7399$tD2.4682@newsread1.news.pas.earthlink.net... 
> 
> 
> 
> > "Shiller" <shill...@gmail.com> wrote in message 
> >news:1172678827.112925.18770@k78g2000cwa.googlegroups.com... 
> >> On Feb 28, 10:44 am, "Massimo-Mastino" <mast...@hotmail.it> wrote: 
> >>> Before the CREATE TABLE statements you should put this: 
> 
> >>> USE Budget 
> >>> go 
> 
> >>> "Shiller" <shill...@gmail.com> ha scritto nel 
> >>> messaggionews:1172675843.097303.293060@8g2000cwh.googlegroups.com... 
> 
> >>> > 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.- Hide quoted text - 
> 
> >>> - Show quoted text - 
> 
> >> I tried using the USE statement, but it's not allowed in stored 
> >> procedure:  "a USE database statement is not allowed in a procedure, 
> >> function or trigger." 
> 
> > Correct, USE is not really transact-SQL it's a control statement for query 
> > analyzer, etc. 
> 
> > Off hand I'm not sure of a solution to your problem, but google may.  I 
> > seem to recall others having similar problems. 
> 
> > Generally though what you want to do is done by a series of scripts, not a 
> > single stored proc.- Hide quoted text - 
> 
> - Show quoted text - 
 
Thank you so much Bill, your technique works.
 
  
Navigation:
[Reply to this message] 
 |