Which Transact-SQL statement should you use?

You are the administrator of a SQL Server database. Database table modifications and additions must occur only between 11:00 P.M. and midnight. You need to ensure that if database table modifications or additions are attempted at any other time, an error is raised and the attempt is not successful.
Which Transact-SQL statement should you use?
A. CREATE TRIGGER TRG_TABLES_ON_LAST_HOUR ON ALL SERVER FOR ALTER_DATABASE
AS
IF DATEPART(hour,getdate())<>1
BEGIN
ROLLBACK
RAISERROR (‘Must wait.’, 16, 1)
END
B. CREATE TRIGGER TRG_TABLES_ON_LAST_HOUR ON DATABASE FOR CREATE_TABLE
AS
IF DATEPART(hour,getdate())<>23
BEGIN
RAISERROR (‘Must wait.’, 16, 1)
END
C. CREATE TRIGGER TRG_TABLES_ON_LAST_HOUR ON DATABASE FOR CREATE_TABLE, ALTER_TABLE
AS
IF DATEPART(hour,getdate())<>23
BEGIN
RAISERROR (‘Must wait.’,16, 1)
END
D. CREATE TRIGGER TRG_TABLES_ON_LAST_HOUR ON DATABASE FOR CREATE_TABLE, ALTER_TABLE
AS
IF DATEPART(hour,getdate())<>23
BEGIN
ROLLBACK
RAISERROR (‘Must wait.’, 16, 1)
END

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.