Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Script

Author  Topic 

Torch
Starting Member

20 Posts

Posted - 2005-07-13 : 23:32:47
I created an SQL script of one of my databases - containing tables and stored procedures.

I want to put this script in a stored prcedure in a different database. However I can't do this as then I will be creating stored procedures within a stored procedure. Is there a way around this problem?

Torch.

Kristen
Test

22859 Posts

Posted - 2005-07-14 : 00:29:16
Are you trying to create a process to build a complete database, including all tables, procedures, etc.?

Kristen
Go to Top of Page

Torch
Starting Member

20 Posts

Posted - 2005-07-14 : 04:24:21
Yes, creating the tables is straight forward however I get syntax errors when trying to create stored procedures within the main stored procedure.
Go to Top of Page

mmarovic
Aged Yak Warrior

518 Posts

Posted - 2005-07-14 : 04:33:38
You mean you want to execute 'create procedure ...' inside your stored procedure? If so use dynamic sql.

declare @cmd varchar(8000)
...
set @cmd = ...
exec (@cmd)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-07-14 : 11:28:00
Probably easiest to have a file containing the script to build the database, and run that.

What are you running it from, client application? Does it have file access to the box that SQL Server is on?

Kristen
Go to Top of Page
   

- Advertisement -