DBI202_-_PE_-_SU_2024_-_s_7_2150.webp
Akari90

DBI202_-_PE_-_SU_2024_-_s_7_2150.webp

  • Media owner Akari90
  • Ngày thêm
Picture 7.1
Question 8:
Create a stored procedure named insertAuthor with @authorID int, @author Name nvarchar(100), @country nvarchar(100), @sex nvarchar(10), @yearOfBirth int as input parameters of the procedure. The stored procedure attempts to insert a new author into the table Authors, but only if an author with the same AuthorID does not already exists:
- if an author with AuthorID = @authorID already exists, the procedure does nothing.
if there is no author with AuthorID = @authorID, the procedure will insert into the table Authors a new row with @authorID, @authorName, @country, @sex, @yearOfBirth as values for its attributes.
For example, when we execute the insertAuthor procedure with input values as in the following statement, a new author with the corresponding values will be inserted into the table Authors:
exec insertAuthor
@authorID = 100,
@authorName = 'Guillaum Musso',
@country = 'France',
@sex = 'Male',
@yearOfBirth = 1975;
But when we run the following statement to execute the insertAuthor procedure, the command completed successfully but no row will be inserted into the table Authors because an author with AuthorID = 1 already exists in the table.
Close
+ 100%
Zoom
Chưa có bình luận nào.

Thông tin

Category
DBI202
Thêm bởi
Akari90
Ngày thêm
Lượt xem
1,089
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
DBI202_-_PE_-_SU_2024_-_s_7_2150.webp
File size
250.7 KB
Dimensions
1920px x 1001px

Share this media

Back
Bên trên Bottom