SQLTeam.com | Weblogs | Forums

Newbie Question with CREATE DATABASE


Hello all. Could someone please help me. I am new to SQL and trying to follow a book instruction to create a practice DB in SQL Server 2014. The book instructs me to run the script below.

CREATE DATABASE AdventureWorks2012 ON (FILENAME = '{drive}:{file path}\AdventureWorks2012_Data.mdf')

So I typed the following in SQL Server 2014 Query Window;

CREATE DATABASE AdventureWorks2012 ON (FILENAME = '{D}:{SQL Server Management Studio\Downloads\AWSampleDB}\AdventureWorks2012_Data.mdf')

and I get the error below

Msg 5105, Level 16, State 2, Line 1
A file activation error occurred. The physical file name '{D}:{SQL Server Management Studio\Downloads\AWSampleDB}\AdventureWorks2012_Data.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation.

I tried removing the brackets and single quotes but no luck. Any help would be kindly appreciated. Thank you!


you should replace the {whatever} including the brace or curly bracket { }

CREATE DATABASE AdventureWorks2012 
ON (FILENAME = 'D:\SQL Server Management Studio\Downloads\AWSampleDB\AdventureWorks2012_Data.mdf')

make sure the path is correct


Thank you so much khtan! Problem solved. I am sure I'll be back for more as I follow along with my book tutorials :slight_smile: