You need to design a mechanism to hold the identifying …

You have a database named DB1. You plan to create a stored procedure that will insert rows into three different
tables. Each insert must use the same identifying value for each table, but the value must increase from one
invocation of the stored procedure to the next. Occasionally, the identifying value must be reset to its initial
value. You need to design a mechanism to hold the identifying values for the stored procedure to use. What
should you do? More than one answer choice may achieve the goal. Select the BEST answer.

You have a database named DB1. You plan to create a stored procedure that will insert rows into three different
tables. Each insert must use the same identifying value for each table, but the value must increase from one
invocation of the stored procedure to the next. Occasionally, the identifying value must be reset to its initial
value. You need to design a mechanism to hold the identifying values for the stored procedure to use. What
should you do? More than one answer choice may achieve the goal. Select the BEST answer.

A.
Create a sequence object that holds the next value in the sequence. Retrieve the next value by using the
stored procedure.

B.
Increment the sequence object to the next value by using an ALTER SEQUENCE statement. Reset the
value as needed by using a different ALTER SEQUENCE statement.

C.
Create an identity column in each of the three tables. Use the same seed and the same increment for each
table.
Insert new rows into the tables by using the stored procedure. Use the DBCC CHECKIDENT command to
reset the columns as needed.

D.
Create a fourth table that holds the next value in the sequence. At the end each transaction, update the
value by using the stored procedure.
Reset the value as needed by using an UPDATE statement.

E.
Create a sequence object that holds the next value in the sequence. Retrieve the next value by using the
stored procedure.
Reset the value by using an ALTER SEQUENCE statement as needed.



Leave a Reply 0

Your email address will not be published. Required fields are marked *