CREATE DATABASE failed. Some file names listed could not be created (Msg 1802)

The error “CREATE DATABASE failed. Some file names listed could not be created. Check related errors.” can occur when the user tries to create a database with file names specified. To understand when this error can appear and how to avoid it, let’s consider the following syntax:

CREATE DATABASE Adventureworks 
ON PRIMARY
( NAME = Adventureworks_Data,
  FILENAME = 'Adventureworks_Data.mdf',
  SIZE = 0,
  MAXSIZE = 30,
  FILEGROWTH = 10% )
LOG ON
( NAME = Adventureworks_Log,
  FILENAME = 'Adventureworks_Log.ldf',
  SIZE = 3MB,
  MAXSIZE = 20MB,
  FILEGROWTH = 3MB );
GO

In this case, the SQL Server will send the following errors:

Msg 5174, Level 16, State 1, Line 2
Each file size must be greater than or equal to 512 KB.
Msg 1802, Level 16, State 1, Line 2
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

The reason why this error appeared is that one of the file parameters is incorrect. In this case, the user set up the size of the data file to zero. Msg 5174 gives a hint that Each file size must be greater than or equal to 512 KB.