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...
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...
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...
Here is everything I have on my codes, the compiler does not allow me to input my name, it will print out "Please enter your name: " but totally ignores it and does not allow me to input my name and just proceeds to my result of ID and Sale. Please help. I've bolded the part where it I should be able to input my name package salesperson; public class Salesperson { String Names; int ID; double Sales; // craeting...
Hi good day i need homework help fast please d32 1./What is the maximum length that a VARCHAR data type can be: a. 65535 b. 1023 C. 255 d. 32767 2.) Why are alias' used for table and columns? a. to make the names easier to understand b. to hide the column or table c. to be able to remove them from the database d. to give the appearance that they are new- 3.)What does the FIELD function allow you...