/*----------------------------------------------------------------
This stored procedure has been generated automatically
using StoredProcBuilder (Version 1.0). To get the latest version of
this builder and other downloads, please visit our site
at http://www.ELLKAY.com.
----------------------------------------------------------------*/
CREATE PROCEDURE Ellkay_GetOrders
as
set nocount on
select OrderID,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,
Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry
from [Orders]
return
GO |
/*----------------------------------------------------------------
This stored procedure has been generated automatically
using StoredProcBuilder (Version 1.0). To get the latest version of
this builder and other downloads, please visit our site
at http://www.ELLKAY.com.
----------------------------------------------------------------*/
CREATE PROCEDURE Ellkay_SaveOrders
@tOrderID int,
@tCustomerID nchar,
@tEmployeeID int,
@tOrderDate datetime,
@tRequiredDate datetime,
@tShippedDate datetime,
@tShipVia int,
@tFreight money,
@tShipName nvarchar,
@tShipAddress nvarchar,
@tShipCity nvarchar,
@tShipRegion nvarchar,
@tShipPostalCode nvarchar,
@tShipCountry nvarchar
as
set nocount on
declare @nCount int
select @nCount = (select count(*) from [Orders] where OrderID = @tOrderID)
if (@nCount = 0)
begin
Insert into [Orders]
(OrderID,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,
ShipVia,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,
ShipCountry)
Values (@tOrderID,@tCustomerID,@tEmployeeID,@tOrderDate,@tRequiredDate,
@tShippedDate,@tShipVia,@tFreight,@tShipName,@tShipAddress,
@tShipCity,@tShipRegion,@tShipPostalCode,@tShipCountry)
select @tOrderID = @@IDENTITY
end
else
begin
update [Orders] set
OrderID = @tOrderID,
CustomerID = @tCustomerID,
EmployeeID = @tEmployeeID,
OrderDate = @tOrderDate,
RequiredDate = @tRequiredDate,
ShippedDate = @tShippedDate,
ShipVia = @tShipVia,
Freight = @tFreight,
ShipName = @tShipName,
ShipAddress = @tShipAddress,
ShipCity = @tShipCity,
ShipRegion = @tShipRegion,
ShipPostalCode = @tShipPostalCode,
ShipCountry = @tShipCountry
where OrderID = @tOrderID
end
return
GO |