Question 3
[2 Marks]
Consider the procedure below. Will the procedure execute successfully? If your answer
is yes, what will the output be? And if it is no, why?
CREATE PROCEDURE NewType
AS
DECLARE @NewType varchar(10)
SELECT @NewType = SUBSTRING(CONCAT('Dog','is','my', 'friend'), 5, 2);
PRINT @NewType
EXECUTE NewType
Question 4
Please explain the difference between the two statements below.
Statement 1:
DISABLE trigger ALL ON ALL SERVER
Statement 2:
DROP Trigger AfterAudit
[4 Marks]
Question 5
[2 Marks]
Consider the information from the table PASS below (please take note that statement 1
is executed already). Can you please show how the result will be when statement 2 is
executed?
.
Statement 1:
CREATE TABLE PASS(
username varchar(20),
password varchar(20))
insert into pass values (‘Test', '123')
insert into pass values (‘Admin’, '321')
Statement 2:
DECLARE @counter INT = 1;
WHILE @counter <= 2
BEGIN
SELECT password from PASS WHERE password =12345 FOR XML RAW
SET @counter = @counter + 1;
SELECT password fram PASS WHERE password =12345 FOR XML PATH
SET @counter = @counter- 1;
END
So
;
Question 6
What will the output be for the statement below?
[2 Marks]