Unanswered: Possible to Create New DB "on the fly"?
Is it possible to have a stored procedure in one database that creates a new database "on the fly" based upon variables? I'm testing the following stored procedure, but I'm getting ERROR 2812.."stored procedure does not exist", even though it does exist. I have also tried fully-qualifying the stored proc by owner, etc. Any thoughts?
--Check to make sure that database doesn't already exist
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'@NewDBName')
--Return value of -1 if Database already exists and abort processing
--Create New Database
CREATE DATABASE [Northwind] ON (NAME = N'@NewDBName', FILENAME = N'@NewDBFilePath' ,
SIZE = 3, FILEGROWTH = 10%)
LOG ON (NAME = N'@NewDBLogName', FILENAME = N'@NewDBLogFilePath' ,
SIZE = 1, FILEGROWTH = 10%)
--If successful, return indicator of "1"
I'm trying to create a new database "on the fly" after a new user registers on a web site as part of their registration/set up. If anyone knows of another or better way to do this I would appreciate any input. Also, I'm doing this with ColdFusion MX...