trying to create database.

  • Hello

    I am taking my SQL exam and trying to practise creating a database I have done the code below but i get an error as below:

    create database tk432 on primary

    ( name = N'tk432_data',filename = N'c:\test\tk432.mdf', size = 8MB, maxsize = unlimited, filegrowth = 16MB ),

    filegroup fg1

    ( name = N'tk432_data2',filename = N'c:\test\tk432.ndf', size = 8MB, maxsize = unlimited, filegrowth = 16MB),

    FILEGROUP Documents CONTAINS filestream default

    ( name = N'Documents',filename = N'c:\test\tk432Documents' )

    log on

    ( name = N'tk432_log', filename = N'c:\test\tk432.ldf', size = 8MB, maxsize = 2048GB, filegrowth = 16MB)

    go

    Msg 102, Level 15, State 1, Line 5

    Incorrect syntax near 'CONTAINS'

    can anyone help?

  • Can't see anything wrong with it. Make sure you are running this on SQL 2008?!? Also make sure Filestream is enabled for the installation and server properties.

  • agh see I am running it on 2005 which doesnt work with filestream that is why this wont be working I am guessing?

    How would I go about checking what you have suggested in the last sentence?

  • http://msdn.microsoft.com/en-us/library/cc645923.aspx

    Robert Murphy, Microsoft MCITP (Database Administrator 2008) and MCAD Certified
  • You should use following syntax for Create Database statement in SS2K5.

    CREATE DATABASE database_name

    [ ON

    [ PRIMARY ] [ <filespec> [ ,...n ]

    [ , <filegroup> [ ,...n ] ]

    [ LOG ON { <filespec> [ ,...n ] } ]

    ]

    [ COLLATE collation_name ]

    [ WITH <external_access_option> ]

    ]

    [;]

    For More: http://msdn.microsoft.com/en-us/library/ms176061(v=SQL.90).aspx

  • thanks everyone that has been very helpful

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

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