Create a cursor that updates the employee table and change a
Create a cursor that updates the employee table and change all the first and last names to all caps
Create a cursor that updates the employee table and change all the first and last names to all caps
Solution
Solution:
DECLARE @emp_id int
DECLARE @emp_first_name varchar(20)
DECLARE @emp_last_name varchar(20)
DECLARE cur_emp CURSOR
FOR
SELECT emp_id, emp_f_name, emp_l_name FROM Employee
OPEN cur_emp
WHILE @@Fetch_status = 0
BEGIN
UPDATE Employee SET emp_f_name= UPPER(@emp_first_name), emp_l_name= UPPER(@emp_last_name) WHERE CURRENT OF cur_emp
FETCH NEXT FROM cur_emp INTO @emp_id,@emp_first_name,@emp_last_name
END
CLOSE cur_emp
DEALLOCATE cur_emp
