1

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**

closed as off-topic by Paul White says GoFundMonica Oct 4 '15 at 11:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Paul White says GoFundMonica
If this question can be reworded to fit the rules in the help center, please edit the question.

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.