Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please download the database from the following link: https://drive.google.com/drive/folders/11FLfdYZUbIDxLuifwLcZfb9sMxGBnPiI Question: Use the NorthWind database Write and submit a create stored procedure statement for a stored

Please download the database from the following link:

https://drive.google.com/drive/folders/11FLfdYZUbIDxLuifwLcZfb9sMxGBnPiI

Question:

Use the NorthWind database

Write and submit a create stored procedure statement for a stored procedure named EmpOrderCount in the dbo schema that takes a territoryid as a parameter. The parameter must be named TerritoryID. The parameter should default to null. The stored proc should not return the rowcount. The stored proc should raise a SQL Server error with a severity of 11, a message saying @TerritoryID not in table with a state of 1 when the given @TerritoryID is not in the Territories table.

Here is an example execution for the null situation:

image text in transcribed

Here is an example execution for a not null situation:

image text in transcribed

Here is an example with a value for @TerritoryID thats not in the Territories table

image text in transcribed

EXEC dbo. EmpOrderCount 100 % Results Sales Person Territory Orders Buchanan, Steve Callahan, Laura Davolio, Naney Dodsworth, Anne Fuller, Andrew King, Robert Leverling, Janet eacoCk, Margaret Suyama, Michael A1l Territorie 42 All Territoriea 104 A1l Territorie 12 3 A1l Territories 43 A1l Territories 9 All Territoriea 72 All Territoriea 127 All Territoriea 15E All Territoriea 67 9 rowis) affected)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

postfix representaion of following infix ( G + H ) * I - J * K / L

Answered: 1 week ago