Need help modifing the below ap_equipment_insert_3 stored procedure to use the bebug argument properly and to add an output clause on the insert near the bottom.
alter Procedure ap_Equipment_Insert_3
-- Store values in equipment table.
-- Return identifier of the record to the caller.
(
@chvMake
varchar(50),
@chvModel
varchar(50),
@chvEqType
varchar(30)
)
As
declare @intEqTypeId int,
@ErrorCode int,
@intEqId int
-- does such eqType already exist in the database
If Not Exists (Select EqTypeId From dbo.EqType Where EqType =
@chvEqType)
--if it does not exist
Begin
-- insert
new EqType in the database
Insert
dbo.EqType (EqType)
Values
(@chvEqType)
-- get id of
record that you've just inserted
Select
@intEqTypeId = @@identity,
@ErrorCode = @@Error
If
@ErrorCode <> 0
begin
Select 'Unable to insert Equipment Type. Error: ',
@ErrorCode
Return -1
End
End
Else
Begin
-- read Id
of EqType
Select
@intEqTypeId = EqTypeId
From
dbo.EqType
Where EqType
= @chvEqType
Select
@ErrorCode = @@Error
If
@ErrorCode <> 0
begin
Select 'Unable to get Id of Equipment Type. Error: ',
@ErrorCode
Return -2
End
End
--insert equipment
Insert dbo.Equipment (Make, Model, EqTypeId)
Values (@chvMake, @chvModel, @intEqTypeId)
-- return id to the caller
Select @intEqId = @@identity,
@ErrorCode = @@Error
If @ErrorCode <> 0
Begin
Select
'Unable to insert Equipment. Error: ', @ErrorCode
Return
-3
End

Need help modifing the below ap_equipment_insert_3 stored procedure to use the bebug argument properly and to...
2. Examine the SQL Script for this test. Explain the purpose of each of the stored procedures listed below. Test2SP1 Test2SP2 Test2SP3 Test2SP4 Test2SP5 Test2SP6 DATABASE CODE: if db_id('Test2PremierProducts') is not null begin use master alter database Test2PremierProducts set SINGLE_USER with rollback immediate drop database Test2PremierProducts end create database Test2PremierProducts go USE Test2PremierProducts; go /* create the tables */ CREATE TABLE Rep (RepNum int Identity(10,10), LastName VARCHAR(15), FirstName VARCHAR(15), Street VARCHAR(15), City VARCHAR(15), State VARCHAR(2), Zip VARCHAR(5), Commission MONEY, Rate DECIMAL(3,2),...
--Create procedure for GetPartNums in SQL --GetPartNums- retrieve all part nums from the database --Database if db_id('TestPremierProducts') is not null begin use master alter database TestPremierProducts set SINGLE_USER with rollback immediate drop database TestPremierProducts end create database TestPremierProducts go USE TestPremierProducts; go /* create the tables */ CREATE TABLE Rep (RepNum int Identity(1,1), LastName VARCHAR(15), FirstName VARCHAR(15), Street VARCHAR(15), City VARCHAR(15), State VARCHAR(2), Zip VARCHAR(5), Commission MONEY, Rate DECIMAL(3,2), PRIMARY KEY (RepNum)); go CREATE TABLE Customer (CustomerNum int Identity(1,1) PRIMARY...
CREATE PROCEDURE createAccount IN inputFirst VARCHAR(40) IN inputLast VARCHAR(40) IN inputEmail VARCHAR(40) IN inputPassword VARCHAR(40) BEGIN DECLARE generatedPid INT INSERT INTO people (first, last, email) VALUES (inputFirst, inputLast, inputEmail) SELECT pid INTO generatedPid FROM people where email inputEmail INSERT INTO password (people_ id, password) VALUES (generatedPid, inputPassword) Consider the following Stored Procedure O true Ofalse - The user only needs so supply the email address to create the account O true Ofalse - The stored procedure user just supply the...
Python Question. I am trying to connect to a database and create a table using Python in this code but I keep getting an error on line 48 saying that "Quotes" is not defined. Could anyone please help me set this up correctly? I am using Azure SQL Database to create this. import pyodbc import json import requests as r import pprint connection_string = 'Driver={ODBC Driver 17 for SQL Server};' \ 'Server=randomquotegenerator.database.windows.net,1433;' \ 'Database=RandomQuoteGenerator;' \ 'Uid=carterholliday;' \ 'Pwd=MIS54002k19;' \ 'TrustServerCertificate=no;'...
Please Explain why I am getting this error from the code below. ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'P_PRODUCT_INFORMATION' I have tried changing everything. Code is below. Table to use: CREATE TABLE ProductTable( ProductID INTEGER NOT NULL primary key, ProductName VARCHAR(50) NOT NULL, ListPrice NUMBER(10,2), Category INTEGER NOT NULL ); / INSERT INTO ProductTable VALUES(299,'Chest',99.99,10); INSERT INTO ProductTable VALUES(300,'Wave Cruiser',49.99,11); INSERT INTO ProductTable VALUES(301,'Megaland Play Tent',59.99,11); INSERT...
Use the SQL statements provided to create your tables. Write one
SQL statement for each of the following problems. You can only use
the conditions listed in the tasks. E.g., in task 1, you cannot
manually look up pid of Information Systems undergraduate
program.
Here is the given code:
drop table textbook_schedule cascade constraints;
drop table textbook_author cascade constraints;
drop table schedule cascade constraints;
drop table course cascade constraints;
drop table textbook cascade constraints;
drop table author cascade constraints;
drop...
Use the Northwind database. Choose the best answer from those given below. Sometimes a database may have a separate table to log certain activities taking place in the database. Create a new table named ‘ChangeLog’ in the Northwind database as follows: ChangeID int identity(1,1) primary key EmpID int (will contain the ID of the employee being changed) User nvarchar(30) (will contain the login of the user making the change) Date smalldatetime (will contain the date of the change) OldRate money (will contain the old payrate of the employee) NewRate money (will contain...
Using the Class database: Create a stored procedure that given a student id number, the procedure will return the student’s highest score and the lowest score on a quiz. Name this procedure "StudentQuiz". Display the student id number, student name, highest score and lowest score. a. Display the stored procedure code you wrote. Insert your snip here: b. Run your stored procedure for student 5. Be sure the stored procedure call and the result set are displayed in...
I need help in SQL management studio please. Question: Create the same query as query 5, but only include artists if they have 'Pop' Genre. Previous question: Create a list of all composers and artists in your database. Include two columns in your record set (the names of the returned columns are in brackets): 'Composer/Artist Name' and 'Type' (which will indicate whether your results are from the composer or artist table). Order by 'Composer/Artist Name'. This is the answer for...
I need help with the following SQL query for a company database (script given below). The name of the Department. The number of employees working in that department. The number of different projects controlled by this department. The name of the project controlled by this department that has the maximum number of employees of the company working on it. The number of the above project. The cumulative sum of the number of employees of the company working on the projects...