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
 Transact-SQL (2000)
 Create database not base on model

Author  Topic 

exergo
Starting Member

5 Posts

Posted - 2004-09-10 : 12:39:41
My question is:
Is it possible to create a database not based on the model database? I mean, a database which does not have the user tables and so on that are present in the model database.

The reason is that we have one SQL Server in which the databases from two different applications are going to be stored (one application is already developped, and the other one is under development; the model database is designed for the one already developed). This implies that in the application under development we don't want to create databases based on the model. We have thought that the solution could be to create the new database based on the model, delete all the information specific to the other application (user tables and so on), and create the information specific to the new application.

So the question is if we are wrong and is possible to create a new database not based on the model, so we wouldn't need to remove from the model the information specific to the other application.

Thanks in advance.

Regards.

X002548
Not Just a Number

15586 Posts

Posted - 2004-09-10 : 13:21:20
ummm...yes?

Did you look in BOL?

I'm not exactly sure what you're asking..

Sample from BOL


USE master
GO
CREATE DATABASE Archive
ON
PRIMARY ( NAME = Arch1,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archdat1.mdf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch2,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archdat2.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch3,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archdat3.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
LOG ON
( NAME = Archlog1,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archlog1.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Archlog2,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archlog2.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
GO


Brett

8-)
Go to Top of Page

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-09-10 : 14:25:47
I don't think you can create a new database that isn't based on model. Point 1 in the Remarks about CREATE DATABASE seems to agree with that opinion.

You could sidestep the issue by creating a blank database to use as a "cookie cutter" and detaching it from SQL Server. When you need a new database, make a copy of the file(s) for that database and attach them. This is manually doing what SQL Server does "under the covers" with model.

-PatP
Go to Top of Page
   

- Advertisement -