In the book on page 119 (chapter 5) in creating database Accounting there is mistake in FILENAME path:
Code:
CREATE DATABASE Accounting
ON
(NAME = 'Accounting',
FILENAME = 'c:\Program Files\Microsoft SQLServer\MSSQL.1\mssql\data\Accounting.mdf,
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = 'AccountingLog',
FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL.1\mssql\data\AccountingLog.ldf',
SIZE = 5 MB,
MAXSIZE = 25 MB,
FILEGROWTH = 5 MB)
GO
After execution of this script you get this message:
Code:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "c:\Program Files\Microsoft SQLServer\MSSQL.1\mssql\data\AccountingData.mdf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15105).
Msg 1802, Level 16, State 1, Line 1 CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
This is the correct script:
Code:
CREATE DATABASE Accounting
ON
(NAME = 'Accounting',
FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL.1\mssql\data\AccountingData.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5)
LOG ON
(NAME = 'AccountingLog',
FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL.1\mssql\data\AccountingLog.ldf',
SIZE = 5 MB,
MAXSIZE = 25 MB,
FILEGROWTH = 5 MB)
GO
Enjoy.