How to create a new database

  • Thread starter Thread starter _Who
  • Start date Start date
W

_Who

I have a script that configures a database as I need it.

Here is a little bit of it:
CREATE TABLE [Albums] (
[AlbumID] [int] IDENTITY (1, 1) NOT NULL ,
[Caption] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[IsPublic] [bit] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [Photos] (
[PhotoID] [int] IDENTITY (1, 1) NOT NULL ,
[AlbumID] [int] NOT NULL ,
[Caption] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[BytesOriginal] [image] NOT NULL ,
[BytesFull] [image] NOT NULL ,.........

But it does not include code to create the database.

Shouldn't I add something like:

CREATE DATABASE "C:\test1.MDF"
GO

at the top
 
If you are using Enterprise Manager, you will have to right click the
database and create the create script.

One great tool to look at is the Database Publishing Wizard. It is a free
download and can even copy your seed data.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Back
Top