microsoft / sql-server-samples

Azure Data SQL Samples - Official Microsoft GitHub Repository containing code samples for SQL Server, Azure SQL, Azure Synapse, and Azure SQL Edge
Other
10.02k stars 8.86k forks source link

aw2008r2-LT script error when creating table trigger Msg 102, Level 15, State 1, Proc. iduSalesOrderDetail, #399

Closed fortunewalla closed 6 years ago

fortunewalla commented 6 years ago

From this page, https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2008r2

Using this file, https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks2008r2/adventure-works-2008r2-lt-script.zip

I tried to run script in SSMS in sqlcmd mode. I only changed the target directories. Attached is the Installation Script --> instawltdb.sql.txt

I got the "Query completed with errors" The other 2008R2 .MDF files in the samples page attached properly to SqlServer2008R2.

What am I doing wrong? Thanks.

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) 
    Apr  2 2010 15:48:46 
    Copyright (c) Microsoft Corporation
    Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
Started - 2018-05-03 14:34:51.947

*** Dropping Database
*** Creating Database
*** Creating Error Log objects
*** Creating Data Types
*** Creating Database Schemas
*** Creating XML Schemas
Create Product catalog description schema
*** Creating Tables
*** Loading Data
Loading [dbo].[BuildVersion]
(1 row(s) affected)
Loading [SalesLT].[Address]
(450 row(s) affected)
Loading [SalesLT].[Customer]
(847 row(s) affected)
Loading [SalesLT].[CustomerAddress]
(417 row(s) affected)
Loading [SalesLT].[Product]
(295 row(s) affected)
Loading [SalesLT].[ProductCategory]
(41 row(s) affected)
Loading [SalesLT].[ProductDescription]
(762 row(s) affected)
Loading [SalesLT].[ProductModel]
(128 row(s) affected)
Loading [SalesLT].[ProductModelProductDescription]
(762 row(s) affected)
Loading [SalesLT].[SalesOrderDetail]
(542 row(s) affected)
Loading [SalesLT].[SalesOrderHeader]
(32 row(s) affected)
*** Adding Primary Keys
*** Adding Unique Constraints
*** Adding Indexes
*** Creating an XML index for the XML column
*** Creating Foreign Key Constraints
*** Creating Table Triggers
Msg 102, Level 15, State 1, Procedure iduSalesOrderDetail, Line 27
Incorrect syntax near ';'.
Msg 102, Level 15, State 1, Procedure iduSalesOrderDetail, Line 39
Incorrect syntax near 'CATCH'.
** An error was encountered during execution of batch. Exiting.

Microsoft SQL Server Management Studio 10.50.1600.1 Microsoft Analysis Services Client Tools 10.50.1600.1 Microsoft Data Access Components (MDAC) 6.1.7601.17514 Microsoft MSXML 3.0 5.0 6.0 Microsoft Internet Explorer 9.11.9600.17843 Microsoft .NET Framework 2.0.50727.5420 Operating System 6.1.7601

jodebrui commented 6 years ago

There were too many semi-colons in the script. Don't know how they ended up there. I updated the script in the .zip. Please download it again and retry. If you are still having issues, please file a new issue.