Looking for help making this stored procedure in Microsoft SQL Server Management
ID: 3533359 • Letter: L
Question
Looking for help making this stored procedure in Microsoft SQL Server Management studio. I can add all the data fields if someone could just show where to put them.
EXAMPLE :
@ISBN (insert value here)
1. Create a stored procedure name procBookInsert that inserts records into the Books, Authors, and BookAuthors as specified below.
a. Create a procBookInsert stored procedure that requires the following parameters. This procedure assumes there is only a single author for a book. Additional authors would be added using a separate procedure.
i. ISBN
ii. Title
iii. PublisherID
iv. Price
v. AuthorName
vi. AuthorPhone
b.
procBookInsert()
if PublisherID is invalid
throw error
else
Fetch Author ID based on Name and Phone
If Author doesn
procBookInsert()
if PublisherID is invalid
throw error
else
Fetch Author ID based on Name and Phone
If Author doesn
Explanation / Answer
CREATE PROCEDURE procBookInsert @ISBN INT , @Title VARCHAR(15) = NULL , @PublisherId TINYINT , @Price VARCHAR(30) = NULL , @AuthorName DATETIME = NULL , @AuthorPhone INT = NULL , AS BEGIN SET NOCOUNT ON INSERT INTO Books ( ISBN , Title , PublisherId , Price , AuthorName , AuthorPhone , ) VALUES ( @ISBN , @Title , @PublisherId , @Price , @AuthorName , @AuthorPhone , ) END you have not given the sturcture of different tables like Books ,Author etc. You let me know the structure and i will write the procedure. contact on timacs12@gmail.com You can rate me after you get the answer
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.