How to create a new database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • _Who

    How to create a new database

    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_Gene ral_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_Gene ral_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.M DF"
    GO

    at the top


  • _Who

    #2
    Re: How to create a new database

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


    "_Who" <CalWhoNOSPAN@r oadrunner.comwr ote in message
    news:uCeAe6$HJH A.2492@TK2MSFTN GP05.phx.gbl...
    >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_Gene ral_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_Gene ral_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.M DF"
    GO
    >
    at the top
    >

    Comment

    • Cowboy \(Gregory A. Beamer\)

      #3
      Re: How to create a new database

      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


      or just read it:


      *************** *************** **************
      | Think outside the box! |
      *************** *************** **************
      "_Who" <CalWhoNOSPAN@r oadrunner.comwr ote in message
      news:uCeAe6$HJH A.2492@TK2MSFTN GP05.phx.gbl...
      >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_Gene ral_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_Gene ral_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.M DF"
      GO
      >
      at the top
      >

      Comment

      Working...