2

Is it possible to alter the LOG file through script when creating a database? I need to set the file size, growth etc, but NOT specify where the DB is to be created. e.g.

CREATE DATABASE [NewDatabase]
GO
ALTER DATABASE [NewDatabase] 
    MODIFY FILE
    (SIZE = 10MB,
    MAXSIZE = UNLIMITED,
    FILEGROWTH = 1MB);
GO
**ALTER DATABASE [NewDatabase]
    MODIFY LOG
    (MAXSIZE = 200MB, 
    FILEGROWTH = 1MB 
    );
GO**
1

1 Answer 1

10

You already wrote it, you just need to specify logical file name of the log file.

ALTER DATABASE [NewDatabase]
MODIFY FILE
(NAME = 'NewDatabase_log',
SIZE = 200MB,
FILEGROWTH = 1MB)

Not the answer you're looking for? Browse other questions tagged or ask your own question.