I am trying to create a new database with T SQL in the query window.
I am working from a book and have doubled checked my spelling, path, and all other things that seem obvious. There is something I am missing. I get an error message when I run my script.
Here is my script.....
ON
(NAME = 'Accounting',
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\
Data\AccountingData.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = 'AccountingLog',
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\
Data\AccountingLog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB)
GO
This is the error that I got...
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL Data\AccountingData.mdf" failed with the operating system error 123(The filename, directory name, or volume label syntax is incorrect.).
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I am running SQL Server 2005 Express. Please help.
Thanks,
stuck
It appears that your path is incorrect. (Though NOT your fault.)
There is an issue with ending a line with a backslash. It is ignored.
Note the path in the error message. There is NOT a backslash between MSSQL and Data.
It probably should be '"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AccountingData.mdf"
Don't break the line like on the backslash.
Code Snippet
CREATE DATABASE AccountingData
ON ( NAME = 'Accounting',
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AccountingData.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5
)
LOG ON ( NAME = 'AccountingLog',
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AccountingLog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB
)
GO
No comments:
Post a Comment