I want to create a database on my SQL Server Express in SQL Server Management Studio and when I execute the command I get this error:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Users\godorojaalexandru\WebApiFileTable\AspNetCoreFileUploadFileTable2\FTDB.mdf" failed with the operating system error 5(Access is denied.).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 query I was instructed to create:
CREATE DATABASE AspNetCoreFileUploadFileTable2
ON PRIMARY
(Name = AspNetCoreFileUploadFileTable2,
FILENAME = 'C:\Users\godorojaalexandru\WebApiFileTable\AspNetCoreFileUploadFileTable2\FTDB.mdf'),
FILEGROUP FTFG CONTAINS FILESTREAM
(NAME = AspNetCoreFileUploadFileTableFS2,
FILENAME='C:\Users\godorojaalexandru\WebApiFileTable\AspNetCoreFileUploadFileTable2\FS')
LOG ON
(Name = AspNetCoreFileUploadFileTableLog2,
FILENAME = 'C:\Users\godorojaalexandru\WebApiFileTable\AspNetCoreFileUploadFileTable2\FTDBLog.ldf')
WITH FILESTREAM (NON_TRANSACTED_ACCESS = FULL,
DIRECTORY_NAME = N'AspNetCoreFileUploadFileTable2');
GO
I went to the directory's properties and observed that the access was set to full-access for both the server and the system, so I don't understand why it says that the access is denied.
I am following a tutorial and it just said to run the command above after creating the directory (WebApiFileTable
). Do I have to create the files themselves (FTDB.mdf
, FS, FTDBLog.ldf
) before running this command, and if so, how do I do it?
Thank you kindly.