Question Locked

Error creating database

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,
I'm taking my first steps in SQL. (this is literally the first thing I've ever done in SQL.)
I have installed SQL server 2005 enterprise edition (180 day test version)
I want to create a new database called German consultants.

Here is the Query I use:

CREATE DATABASE German_Consultants
ON Primary
(Name = German_Consultants_DATA,
Filename = 'Q:\German Consultants\German_Consultants.mdf',
Size = 45MB,
Maxsize = 60,
FileGrowth = 20),

LOG ON
(NAME = German_Consultants_LOG,
Filename = 'R:\German Consultants\German_Consultants.ldf',
SIZE = 5MB,
MAXSIZE = 20MB,
FILEGROWTH = 5MB)

It fails with the following error:
Msg 102, Level 15, State1, Line 9
Incorrect syntax near 'LOG'.

Aditional information:
1. I have pre created the "German Consultants" directory on both the Q and the R drive. (I have checked the NTFS permissions and I have full controle on both directories.
2. The word "LOG" in the query is in pink.
3. The query below (which I adapted from an exemple) runs just fine. I don't see why this one is OK and the above one isn't.

CREATE DATABASE Database_2
ON PRIMARY
(NAME = Database_2_dat,
FILENAME = 'q:\german consultants\dat.mdf',
SIZE = 2MB,
MAXSIZE = 20,
FILEGROWTH = 10%)
LOG ON
(NAME = Database_2_log,
FILENAME = 'r:\german consultants\log.ldf',
SIZE = 4MB,
MAXSIZE = 10MB,
FILEGROWTH = 20%)

3 replies

by absolutely

There is a capitalization discrepancy within the LOG ON block.

LOG ON
(NAME = German_Consultants_LOG,
[b]Filename[/b] = 'R:\German Consultants\German_Consultants.ldf',
SIZE = 5MB,
MAXSIZE = 20MB,
FILEGROWTH = 5MB)

...

LOG ON
(NAME = Database_2_log,
[b]FILENAME[/b] = 'r:\german consultants\log.ldf',
SIZE = 4MB,
MAXSIZE = 10MB,
FILEGROWTH = 20%)

by philds

Thanks, that's it. I'll have to get used to correct capitalization.

This discussion is closed to new replies.