I created a table in SQL Server called Employee, and now I want to update the table using a stored procedure.
The table has columns emp_name, emp_codeand status. Suppose there are three records in the table: initially in the stored procedure I want to get the last two records using the select statement, and I have to get the extracted records' statusto 'Y'.
I wrote a stored procedure, but this does not affect the original table. Please offer a request for a stored procedure.
Here is the request I made:
create procedure updtdemployee As
select e.Emp_name ,e.Circle
from employee e
where e.Emp_Code ='2501' or e.Emp_Code='2502'
begin
update employee set status='Y' where Emp_name = employee.Emp_name
end
source
share