Question: 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




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 @Customerld INT @Name VARCHAR(100) @Country VARCHAR(100) DECLARE Counter DATE SET Counter = 1 DECLARE PrintCustomers READ_ONLY FOR SELECT Customerld, Name, Country FROM Customers OPEN PrintCustomers FETCH FROM PrintCustomers INTO @ Customerld, @Name, @Country WHILE @@FETCH_STATUS = 0 BEGIN IF @Counter = 1 BEGIN IF @Counter = 1 BEGIN PRINT 'CustomerlD' + CHAR(9) + 'Name' + CHAR(9) + CHAR(9) + CHAR(9) + 'Country' PRINT' END PRINT (@Customerld AS VARCHAR(10)) + CHAR(9) + CHAR(9) T CHAR(9) + @Name + CHAR(9) + @ Country SET Counter = Counter + 1 FETCH FROM PrintCustomers INTO @ Customerld, @Name, @Country END DEALLOCATE PrintCustomers @Customerld, @Name, @Country END DEALLOCATE PrintCustomers CLOSE PrintCustomers END GO
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
