How to create a new database

Discussion in 'ASP .Net' started by _Who, Sep 26, 2008.

  1. _Who

    _Who Guest

    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
    _Who, Sep 26, 2008
    #1
    1. Advertising

  2. _Who

    _Who Guest

    I'm sorry I sent this to the wrong NG.


    "_Who" <> wrote in message
    news:uCeAe6$...
    >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
    >
    _Who, Sep 26, 2008
    #2
    1. Advertising

  3. 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! |
    ********************************************
    "_Who" <> wrote in message
    news:uCeAe6$...
    >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
    >
    Cowboy \(Gregory A. Beamer\), Sep 26, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. casper
    Replies:
    0
    Views:
    9,031
    casper
    Apr 24, 2006
  2. Replies:
    0
    Views:
    835
  3. prady
    Replies:
    2
    Views:
    429
    Phil H
    Dec 29, 2007
  4. casper

    CREATE DATABASE permission denied in database 'master'

    casper, Apr 24, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    228
    casper
    Apr 24, 2006
  5. Replies:
    2
    Views:
    437
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
Loading...

Share This Page