The script pasted below was provided to us by our professor. He wants us to use this script to create a DB, but there is an issue. When I run this script. I get an error.
Msg 5133, Level 16, State 1, Line 4
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\WonderfulWheels.mdf" failed with the operating system error 3(The system cannot find the path specified.).Msg 1802, Level 16, State 1, Line 4
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I understood where the issue was, but I'm unable to solve it.
Code problem area:
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'WonderfulWheels', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\WonderWheels.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'WonderfulWheels_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\WonderWheels_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
I don't have a similar file path as mentioned in this script, as I don't understand what these filenames are like. Do I need to generate that file path on my own? Some guidance, please.
In the SQL Server 2019 folder, I got two subfolders, licenses
and common7
.
I looked around for solutions and did not understand any of them.
FILENAME = N'WonderWheels.mdf'
Common7
folder suggests that you're actually looking at an SQL Server Management Studio (SSMS) folder (e.g.:C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7
) instead of the SQL Server folder. SSMS is a tool for connecting to and managing SQL Server instances, not itself a database system. Have you actually installed an instance of SQL Server 2019? If so then what's the output ofSELECT @@VERSION
?SELECT physical_name FROM master.sys.database_files
to see where those files are stored.SELECT SERVERPROPERTY('InstanceDefaultDataPath') AS DefaultDataPath, SERVERPROPERTY('InstanceDefaultLogPath') AS DefaultLogPath;