microsoft / microsoft/sql-server-samples

insnwd.sql is not a working code ( Jan 2022)

Open
#1,091 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
11.2k
Forks
9.1k
Avg merge
2d 7h
Merged PRs (30d)
14

Description

Any time I attempt to download or even copy and paste the code in to SSMS I end up with an error.
Below is the error message I receive. I am new to this and do not know how to fix this and it appears that I would have to do so because of frequent syntax errors. What do I do now?

Error Message:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
Msg 3702, Level 16, State 4, Line 13
Cannot drop database "Northwind" because it is currently in use.
Msg 1801, Level 16, State 3, Line 15
Database 'Northwind' already exists. Choose a different database name.
Msg 3726, Level 16, State 1, Line 113
Could not drop object 'dbo.Customers' because it is referenced by a FOREIGN KEY constraint.
Msg 2714, Level 16, State 6, Line 175
There is already an object named 'Customers' in the database.
Msg 1913, Level 16, State 1, Line 193
The operation failed because an index or statistics with name 'City' already exists on table 'dbo.Customers'.
Msg 1913, Level 16, State 1, Line 195
The operation failed because an index or statistics with name 'CompanyName' already exists on table 'dbo.Customers'.
Msg 1913, Level 16, State 1, Line 197
The operation failed because an index or statistics with name 'PostalCode' already exists on table 'dbo.Customers'.
Msg 1913, Level 16, State 1, Line 199
The operation failed because an index or statistics with name 'Region' already exists on table 'dbo.Customers'.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open insnwd.sql and run it in SQL Server Management Studio while reviewing the reported errors, especially the syntax error and the Northwind database and object conflicts. Reproduce the failure and identify the script changes needed for it to execute without the listed errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.