Adding Filegroup via TSQL

  • I'm trying to learn to create/modify tables via TSQL rather than the GUI and am getting an error. I've tried changing everything I can think of but still get an error. Can someone please tell me what I'm doing wrong?

    Thanks,

    Bob

    The sql...

    ALTER DATABASE JeanAnnTest

    ADD FILEGROUP JA_FG

    (NAME = JeanAnn2,

    FILENAME = 'c:\MSSQL\JeanAnnTestNewFilegroup777.ndf',

    SIZE = 6MB,

    MAXSIZE = 18MB,

    FILEGROWTH = 1)

    The error...

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near 'NAME'.

  • ALTER DATABASE JeanAnnTest

    ADD FILEGROUP JA_FG;

    ALTER DATABASE JeanAnnTest

    ADD FILE

    (

    NAME = JeanAnn2,

    FILENAME = 'c:\MSSQL\JeanAnnTestNewFilegroup777.ndf',

    SIZE = 6MB,

    MAXSIZE = 18MB,

    FILEGROWTH = 1

    )

    TO FILEGROUP JA_FG;

    Susantha

  • Susantha,

    This worked.... thanks very much! (My book was not that detailed when only adding a filegroup to an existing database)

    Bob

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

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