Creating schema?

  • Hello everyone,

    I want to create a database with a structure similiar the the AdventureWorks database:

    CREATE TABLE [myDB].[Production].[Culture] (

    [CultureID] nchar(6) NOT NULL,

    [Name] nvarchar(50) NOT NULL,

    [ModifiedDate] datetime NOT NULL

    )

    When I run the following create table statement, I get a the following error:

    Msg 2760, Level 16, State 1, Line 1

    The specified schema name "Production" either does not exist or you do not have permission to use it.

    How would I go about creating a schema call Production?

    Thanks,

    Strick

  • Have a look at the "CREATE SCHEMA" statement in books online.

    You will need to run something like

    CREATE SCHEMA Production

  • Hi stricknyn,

    First find if you create any schema for this.

    or just execute the following.

    GRANT ALTER ON SCHEMA::dbo TO RoleName

    (where ROLENAME is DBroles)

    or

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/df74fc36-20da-4efa-b412-c4e191786695.htm

  • check whether the schema exists, if so grant permission .

    if the schema does not exists then create the schema.

    check out BOL for all these.

    why do u need the schema.

    "Keep Trying"

  • Thanks all.

    Its more for organization than anything. When I look at the AdventureWorks SQL database that ships with SQL 2005, I like that all the production tables are together, all the sales tables are together, etc. So I figured I'll use the same type of organization in mine.

    Thanks!

    Strick

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply