select * into #student1 from student select * from #student1 create table #temp2( id int not null,name nvarchar(50))--drop table #temp2CREATE TABLE #tempCodes (PromotionsCode VARCHAR(50),CustomerId int) delete from #student1 output deleted.id, delete…