Cannot specify a log file in a CREATE DATABASE statement without also specifying at least one data file.

Error Message:
Msg 188, Level 15, State 1, Line 2
Cannot specify a log file in a CREATE DATABASE statement without also specifying at least one data file.

Severity level:
15.

Description:
This error message appears when you try to specify a log file in a CREATE DATABASE statement, without specifying at least one data file.

Consequences:
The SQL statement cannot be parsed and further execution is stopped.

Resolution:
Error of the Severity level 15 are generated by the user and can be fixed by the SQL Server user. Either you remove the data log file specification or you specify at least one data file.

Versions:
All versions of SQL Server.

Example(s):
USE master;
IF DB_ID (N’MyExample’) > 0
 DROP DATABASE MyExample;
GO
CREATE DATABASE MyExample
LOG ON
( NAME = MyExample_Log,
    FILENAME = ‘MyExample_Log.ldf’,
    SIZE = 5MB,
    MAXSIZE = 25MB,
    FILEGROWTH = 5MB );
GO

Remarks:
In the above example we try to create the database MyExample and specify the MyExample_Log log file. Because we have not specified a data file, the error is raised.




Related Articles :

  • No Related Articles Found

No comments yet... Be the first to leave a reply!

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |