sql - Creating a Stored Procedure -
i trying create stored procedure allow me update actualarrivaldate , actualdeparturedate in tripstop table stoptypecode = drop in tripstoporder table.
create proc spupdatetable @orderid int, @arrivaldate datetime, @departuredate datetime begin begin transaction select * dbo.tripstoporder join dbo.tripstop on dbo.tripstoporder.tripstopid = dbo.tripstop.tripstopid orderid = ''and stoptypecode ='drop'
once find record need grab tripstopid , pass update statement. not sure how this...can use temp table run select statement pick tripstopid?
update dbo.tripstop set arrivaldate='',departuredate='' tripstopid = '' end commit
any ideas or suggestions appreciated. ~newbie~
instead of doing select , update, change clause in update statement:
where tripstopid = (select t.tripstopid tripstoporder o inner join tripstop t on o.tripstopid = t.tripstopid orderid = @orderid , stoptypecode = 'drop')