I am installing the AdventureWorks 2008
sample database from here. I am executing the following script in SQL Server 2008 in SQLCMD
mode, but getting the error
Msg 102, Level 15, State 1, Line 28
Incorrect syntax near ':'.
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (X64) Jul 9 2008 14:17:44
Copyright (c) 1988-2008 Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 (Build 7600: )Started - 2013-04-07 10:46:30.423
* Dropping Database
* Creating DatabaseMsg 5105, Level 16, State 2, Line 2
A file activation error occurred. The physical file name '$(SqlSamplesDatabasePath)AdventureWorks2008_Data.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation.Msg 1802, Level 16, State 1, Line 2
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.Msg 5011, Level 14, State 5, Line 2
User does not have permission to alter database 'AdventureWorks2008', the database does not exist, or the database is not in a state that allows access checks.Msg 5069, Level 16, State 1, Line 2
ALTER DATABASE statement failed.Msg 911, Level 16, State 1, Line 2
Database 'AdventureWorks2008' does not exist. Make sure that the name is entered correctly. . .
This is part of the script I'm using:
/*============================================================================
File: instawdb.sql
Summary: Creates the AdventureWorks 2008R2 OLTP sample database.
SQL Server Version: 10.50.1600
------------------------------------------------------------------------------
This file is part of the Microsoft SQL Server Code Samples.
Copyright (C) Microsoft Corporation. All rights reserved.
This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation. See these other
materials for detailed information regarding Microsoft code samples.
All data in this database is ficticious.
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
============================================================================*/
-- Be sure to enable FULL TEXT SEARCH before running this script
-->> WARNING: THIS SCRIPT MUST BE RUN IN SQLCMD MODE INSIDE SQL SERVER MANAGEMENT STUDIO. <<--
:on error exit
-- IMPORTANT
/*
* In order to run this script manually, either set the environment variables,
* or uncomment the setvar statements and provide the necessary values if
* the defaults are not correct for your installation.
*/
setvar SqlSamplesDatabasePath "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA"
setvar SqlSamplesSourceDataPath "C:\Users\DEVESH\Downloads\"
IF '$(SqlSamplesSourceDataPath)' IS NULL OR '$(SqlSamplesSourceDataPath)' = ''
BEGIN
RAISERROR(N'The variable SqlSamplesSourceDataPath must be defined.', 16, 127) WITH NOWAIT
RETURN
END
IF '$(SqlSamplesDatabasePath)' IS NULL OR '$(SqlSamplesDatabasePath)' = ''
BEGIN
RAISERROR(N'The variable SqlSamplesDatabasePath must be defined.', 16, 127) WITH NOWAIT
RETURN
END
SET NOCOUNT OFF;
GO
PRINT CONVERT(varchar(1000), @@VERSION);
GO
PRINT '';
PRINT 'Started - ' + CONVERT(varchar, GETDATE(), 121);
GO