Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I installed SQL Server 2012 on my laptop. I am trying to run a script to create a simple database.

SQL Server version: 11.0.3128

SSMS starting parameters:

server type: database engine
server name: BOGLENETWORK\SQLEXPRESS
Authentication: Windows Authentication
user name:boglenetwork\admin121

I did some online search and it seems like The account I used doesn't have proper permission to write to the folder in which .mdf and .ldf file should be held. I would like to know do I check the account permission and make necessary modification the the file can be created in the destination folder. Thank for you advise and help!

forum post on a similar issue.

I received the follow message:

Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLEXPRESS\MSSQL\DATA\saledat.mdf" failed with the operating system error 3(The system cannot find the path specified.).
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

Here is the code I am using to create the database:

USE master;
GO
CREATE DATABASE sales
ON 
( NAME = sales_dat,
    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLEXPRESS\MSSQL\DATA\saledat.mdf',
    SIZE = 10,
    MAXSIZE = 50,
    FILEGROWTH = 5 )
LOG ON
( NAME = sales_log,
    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLEXPRESS\MSSQL\DATA\salelog.ldf',
    SIZE = 5MB,
    MAXSIZE = 25MB,
    FILEGROWTH = 5MB ) ;
GO
share|improve this question

closed as too localized by Jon Seigel, Mark Storey-Smith, Marian, RolandoMySQLDBA, dezso Mar 9 '13 at 10:33

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
The account you used to start SSMS is irrelevant -- the database engine service account must have the required permissions in the file system. Does that path actually exist? Did you do something like change the service account, or play around with the folder permissions? –  Jon Seigel Mar 3 '13 at 16:40

1 Answer 1

I found out that I mis-typed the path name in this case. The correct folder name is MSSQL11.SQLEXPRESS instead of MSSQL11.MSSQLEXPRESS.

After correcting the folder path, I was able to create the database. Thanks!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.