I am using SQL Server 2014 and I am trying to create a database with this command
CREATE DATABASE [EFSDB]
ON (NAME = N'EFSDB_Data', FILENAME = N'$MDF', SIZE = 2, FILEGROWTH = 10)
LOG ON (NAME = N'EFSDB_Log', FILENAME = N'$LDF' , SIZE = 2, FILEGROWTH = 10%)
However, I am getting this error:
A file activation error occurred. The physical file name '$MDF' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Msg 1802, Level 16, State 1, Line 42
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
This command works in SQL Server 2008 but doesn't work in SQL Server 2014.
This command is saved in sample.sql
file and that file gets executed using the below command:
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\OSQL.EXE" -S ServerName -E -i Sample.sql