September 18, 2013 at 11:08 am
I am having trouble creating my first database file. Here is the syntax used:
CREATE DATABASE Accounting
ON
(NAME = 'Accounting',
FILENAME = 'C:\Program Files\Microsoft SQL
SERVER\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingData.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = 'AccountingLog',
FILENAME = 'C:\Program Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingLog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB);
GO
And I get an error message when executed:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL
SERVER\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingDat a.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 have double checked my file name path, I have removed spaces in the syntax, added underscores, and changed the folder from MSSQL10.SQLEXPRESS to MSSQL11.TSQLLAB as that is where my adventure works database is. I keep getting the same error and cannot figure out why this isn't working, when the directory path is correct and has been verified multiple times.
Can someone please help me figure out what I am missing?
Also, the book I am using covers SQL Server 2008, however I am using SQL Server 2012 Express. Not sure if the Syntax is different from 2008 to 2012.
September 18, 2013 at 11:29 am
try
CREATE DATABASE Accounting
ON
(NAME = Accounting,
FILENAME = 'C:\Program Files\Microsoft SQL SERVER\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingData.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = AccountingLog,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingLog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB);
Dan
If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.
September 18, 2013 at 11:30 am
Use the GUI with the exact same parameters but script out the T-SQL before creating it (you can do this by hitting the 'Script' dropdown at the top of the "New Database" popup box). Compare the T-SQL to what you've typed, it will probably reveal your error. If not, see what happens when you create the database using the GUI.
----------------------------------------------------------------------------
Sacramento SQL Server users group - http://sac.sqlpass.org
Follow me on Twitter - @SQLDCH
----------------------------------------------------------------------------
September 18, 2013 at 12:50 pm
Dan.Humphries (9/18/2013)
try
CREATE DATABASE Accounting
ON
(NAME = Accounting,
FILENAME = 'C:\Program Files\Microsoft SQL SERVER\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingData.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = AccountingLog,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\AccountingLog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB);
I thought you needed the ' 's surrounding the names?
September 18, 2013 at 12:52 pm
Also, for anyone else reading this, I tried Dan's suggestion and the original syntax again, and got an access denied error this time, not the other one. After restarting SQL Server Express as administrator, I was able to run my original code with no issues. Thanks everyone for the help though!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply