日期:2014-05-17 浏览次数:20417 次
--订单信息添加存储过程
ALTER PROCEDURE P_BatchImportOrders
@OutCustomerName nvarchar(20),
@OutCustomerID int,
@OutCompanyIp nvarchar(300),
@OutPackageID int,
@OutproductID int,
@OutGeneratorRoom nvarchar(50),
@OutServerTypeID int,
@OutCpu nvarchar(50),
@OutBandwidth nvarchar(50),
@OutHardDisk nvarchar(50),
@OutMemory nvarchar(50),
@Outprice float,
@OutStaffID int,
@OutTechnology nvarchar(10),
@OutOrderDate datetime,
@OutExpirationDate datetime,
@OutModificationCost float,
@OutRenewalDate datetime,
@OutRenewalStatus int,
@OutRenewalFee float,
@OutRemarks nvarchar(MAX),
@OutEntryPerson nvarchar(20),
@OutOrderID int
as
begin
declare @CustomerID nvarchar(20)
select @CustomerID=CustomerID from Customer where CustomerName=@OutCustomerName
set @OutCustomerID=@CustomerID
begin
if @OutPackageID<=0
begin
insert into Products values(@Outprice,@OutGeneratorRoom,@OutServerTypeID,@OutCpu,@OutBandwidth,@OutHardDisk,@OutMemory)
declare @productID int
select @productID=max(productID) from Products
set @OutproductID=@productID
end
else
begin
set @OutproductID=0
end
insert into TableOrders(CustomerID,PackageID,productID,StaffID,Technology,OrderDate,ExpirationDate,ModificationCost,RenewalDate,RenewalStatus,RenewalFee,Remarks,EntryPerson,state) values (@OutCustomerID,@OutPackageID,@OutproductID,@OutStaffID,@OutTechnology,@OutOrderDate,@OutExpirationDate,@OutModificationCost,@OutRenewalDate,@OutRenewalStatus,@OutRenewalFee,@OutRemarks,@OutEntryPerson,0)
declare @orderid int
select @orderid=max(OrderID) from TableOrders
set @OutOrderID=@orderid
begin
insert into UseCompanyIp(IpAddress,OrderIDs) values (@OutCompanyIp,@OutOrderID)
insert into CompanyIp(IpAddress,IpState,OrderID) values (@OutCompanyIp,1,@OutOrderID)
end
end
end
--订单信息添加存储过程
ALTER PROCEDURE P_BatchImportOrders
@OutCustomerName nvarchar(20),
@OutCustomerID int,
@OutCompanyIp nvarchar(300),
@OutPackageID int,
@OutproductID int,
@OutGeneratorRoom nvarchar(50),
@OutServerTypeID int,
@OutCpu nvarchar(50),
@OutBandwidth nvarchar(50),
@OutHardDisk nvarchar(50),