--把购物车中的信息导入到订单中,并且删除购物车信息--------
create proc createForm
(@customerID int,@totalPrice float)
as
begin
declare @orderID varchar(40)
--根据用户ID获取购物车的carId--
set @orderID=(select carID from ShoppingCar where customerID=@customerID)
--向OrderForm表中插入数据--
insert into OrderForm values (@orderID,@customerID,getdate(),@totalPrice)
--把用户的ShoppingCarDetails数据保存到OrderFormDetails表中--
insert into OrderFormDetails select * from ShoppingCarDetails where carID=@orderID
--删除购物车相关数据--
delete from ShoppingCarDetails where carID=@orderID
delete from ShoppingCar where carID=@orderID
end