Msg 153, Level 15, State 1, Line 14 Invalid usage of the option size in the CREATE/ALTER DATABASE statement.

  • create database contacts

    on primary

    (

    name='contacts',

    filename='D:\contacts\contacts.mdf',

    size=5mb,

    filegrowth=3%

    )

    log on

    (

    name='contacts',

    filename='D:\contacts\contacts.ldf'

    size=5mb,

    filegrowth=3%

    )

  • try

    create database contacts

    on primary

    (

    name='contacts',

    filename='D:\contacts\contacts.mdf',

    size=5mb,

    filegrowth=3%

    )

    log on

    (

    name='contacts',

    filename='D:\contacts\contacts_log.ldf',

    size=5mb,

    filegrowth=3%

    )

  • Few problems

    There's a missing comma after the log file's physical name (which is what causes that error)

    You've given the data and log files the same logical name. File names must be unique within a database.

    Also, 3% growth is not a recommended setting. Set the growth to a fixed increment that's sensible considering the size of teh DB and the expected growth.

    This works and has a much more optimal growth setting for the DB.

    CREATE DATABASE contacts ON PRIMARY (

    NAME='contacts',

    FILENAME='D:\Develop\Databases\contacts.mdf',

    SIZE=5mb,

    FILEGROWTH=1mb

    )

    LOG ON (

    NAME='contacts_log',

    FILENAME='D:\Develop\Databases\contacts.ldf',

    SIZE=5mb,

    FILEGROWTH=1mb

    )

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

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