I have created a table in SQL Server called "Employee", and now I want to update the table using a stored procedure.
The table has emp_name, emp_code and status columns. Assume the table has three records: initially, in the stored procedure I want to fetch the last two records using a select statement and I have to the fetched records' status to 'Y'.
I have written a stored procedure, but it's not affecting the original table. Kindly suggest the query for the stored procedure.
Here is the query I have 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
WHEREin anUPDATE.