Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The language is T-SQL Your code must work with a database named CISAssignment. Within that database you should create an instance of the Northwind tables

The language is T-SQL

Your code must work with a database named CISAssignment. Within that database you should create an instance of the Northwind tables and data. The goal is to add two columns and a default to each table in the database. To do this you must use a cursor with a dynamic SQL ALTER TABLE ADD statement. If you have questions on the syntax of the ALTER TABLE ADD statement, consult the online Microsoft documentation for that statement. You can find the name of each table in a database with the following query:

image text in transcribed

Add two columns to each table: 1. IsDeleted, which is a BIT datatype. The column definition must include a default value for the IsDeleted column. The default must be zero. This column must not allow nulls. 2. DeletedDateTime, which is a DATETIME datatype. This column must allow nulls. There is no visible output for this problem. The effect is that each Northwind table in the CIS487Assignment12 database will now have two additional columns with the appropriate constraints. Either all of the tables must be modified or, if an error is encountered, then none of the tables will be modified. The stored proc must have a return value of zero if it completes successfully. Otherwise, it should return the error number from the error number function. The stored proc must be named AddDeletedInfoColumns Do not include the statements to create the Northwind database in your script.

*The Northwind database diagrams are shown below

image text in transcribed

image text in transcribed

SELECT TABLE_NAME FROM CIS487Assignment 12. INFORMATION_SCHEMA,TABLES WHERE TABLE_NAME = 'sysdiagrams AND TABLE_TYPE = 'BASE TABLE ORDER BY TABLE_NAME; Condensed Type Allow Nulls Identity int Order Details Column Name Condensed Type Allow Nulls Identity 8 OrderlD int 9 ProductID int UnitPrice money Quantity smallint Discount real nvarchar(40) Categories Column Name Condensed Type Allow Nulls Identity 9 CategoryID int CategoryName nvarchar(15) Description ntext Picture image int 000000 Products Column Name 8 ProductID Product Name SupplierlD CategoryID QuantityPerUnit UnitPrice UnitsinStock UnitsOnOrder ReorderLevel 00000 int nvarchar(20) money smallint smallint smallint 00000000000 8 Identity Discontinued bit Employee Territories Column Name Condensed Type Allow Nulls Identity 9 Employeeld TerritoryID nvarchar(20) int Customers Column Name Condensed Type Allow Nulls 9 CustomerlD nchar(5) CompanyNa... nvarchar(40) Contact Name nvarchar(30) Contact Title nvarchar(30) Address nvarchar(60) M City nvarchar(15) Region nvarchar(15) PostalCode nvarchar(10) Country nvarchar(15) Phone nvarchar(24) Fax nvarchar(24) OOO |TOO Territories Column Name Condensed Type Allow Nulls Allow Nulls Identity 8 TerritoryID nvarchar(20) TerritoryDescription nchar(50) RegionID int Suppliers Column Name Condensed Type Allow Nulls Identity Suppliers int CompanyName nvarchar(40) ContactName nvarchar(30) Contact Title nvarchar(30) M Address nvarchar(60) City nvarchar(15) Region nvarchar(15) PostalCode nvarchar(10) Country nvarchar(15) Phone nvarchar(24) M Fax nvarchar(24) HomePage ntext 000 Region Column Name Condensed Type Allow Nulls Identity 9 RegionID int RegionDescription nchar(50) 000 CustomerCustomerDemo Column Name Condensed Type Allow Nulls Identity 9 CustomerlD nchar(5) CustomerTypeID nchar(10) Employees Column Name Condensed Type Allow Nulls Identity Employeeld int LastName nvarchar(20) FirstName nvarchar(10) Title nvarchar(30) TitleOfCourtesy nvarchar(25) BirthDate datetime HireDate datetime Address nvarchar(60) City nvarchar(15) Region nvarchar(15) PostalCode nvarchar(10) M Country nvarchar(15) HomePhone nvarchar(24) Extension nvarchar(4) Photo image OOOOOOOOOOOOOOOOOOO Orders Column Name Condensed Type Allow Nulls Identity od 9 OrderD int CustomerlD nchar(5) Employeeld int OrderDate datetime RequiredDate datetime ShippedDate datetime ShipVia int Freight money ShipName nvarchar(40) ShipAddress nvarchar(60) Ship City nvarchar(15) Ship Region nvarchar(15) ShipPostalCode nvarchar(10) Ship Country nvarchar(15) D Customer Demographics Column Name Condensed Type Allow Nulls Identity CustomerTypeID nchar(10) CustomerDesc ntext 000 ntext Notes Reports To PhotoPath int nvarchar(255) Shippers Column Name Condensed Type Allow Nulls Identity 8 ShipperID int CompanyName nvarchar(40) Phone nvarchar(24)

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

need assistance with directions on these steps

Answered: 1 week ago

Question

=+ a. How does this change affect the incentives for working?

Answered: 1 week ago