我正在从这里AdventureWorks 2008
安装示例数据库。我在 SQL Server 2008模式下执行以下脚本,但出现错误SQLCMD
消息 102,级别 15,状态 1,第 28 行
':' 附近的语法不正确。
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (X64) 2008 年 7 月 9 日 14:17:44
版权所有 (c) 1988-2008 Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 (Build 7600: )开始时间 - 2013-04-07 10:46:30.423
* 删除数据库
* 创建数据库消息 5105,级别 16,状态 2,第 2 行
发生文件激活错误。物理文件名“$(SqlSamplesDatabasePath)AdventureWorks2008_Data.mdf”可能不正确。诊断并更正其他错误,然后重试该操作。消息 1802,级别 16,状态 1,行 2
创建数据库失败。无法创建列出的某些文件名。检查相关错误。消息 5011,级别 14,状态 5,第 2 行
用户无权更改数据库“AdventureWorks2008”,数据库不存在,或数据库未处于允许访问检查的状态。消息 5069,级别 16,状态 1,第 2 行
ALTER DATABASE 语句失败。消息 911,第 16 级,状态 1,第 2 行
数据库“AdventureWorks2008”不存在。确保输入的名称正确。. .
这是我正在使用的脚本的一部分:
/*============================================================================
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