Question: 2. The code below contains errors. Can you please correct the errors so that the procedure can execute successfully. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER

 2. The code below contains errors. Can you please correct the

2. The code below contains errors. Can you please correct the errors so that the procedure can execute successfully.

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE PROCEDURE PrintCustomers_Cursor

AS

BEGIN

SET NOCOUNT ON;

DECLARE @CustomerId INT

,@Name VARCHAR(100)

,@Country VARCHAR(100)

DECLARE Counter DATE

SET Counter = 1

DECLARE PrintCustomers READ_ONLY

FOR

SELECT CustomerId, Name, Country

FROM Customers

OPEN PrintCustomers

FETCH FROM PrintCustomers INTO

@CustomerId, @Name, @Country

WHILE @@FETCH_STATUS = 0

BEGIN

IF @Counter = 1

BEGIN

PRINT 'CustomerID' + CHAR(9) + 'Name' + CHAR(9) + CHAR(9) + CHAR(9) + 'Country'

PRINT '------------------------------------'

END

PRINT (@CustomerId AS VARCHAR(10)) + CHAR(9) + CHAR(9) + CHAR(9) + @Name + CHAR(9) + @Country

SET Counter = Counter + 1

FETCH FROM PrintCustomers INTO

@CustomerId, @Name, @Country

END

DEALLOCATE PrintCustomers

CLOSE PrintCustomers

END

Question z Compare and explain the difference between the two statements. Not yet answered Marked out of 5.00 Statement 1: CREATE PROCEDURE Insert_data P Flag question @Data INT AS BEGIN SELECT @Data = Student_no FROM Student Test; PRINT @Data END EXECUTE Insert_data '1' Statement 2: DECLARE @Data INT BEGIN SELECT @Data = Student_no FROM Student Test; PRINT @Data CND

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!