Hi i am fairly new to stored procs and get an error on the line DECLARE. Can anyone point me in the right direction?
thanks
-Gus
Code:
ALTER PROCEDURE [dbo].[usp_ShippingOptionsGet]
@ProductsWeight int,
@CustomerID
AS
DECLARE @ShippingArea Char(3)
SELECT @ShippingArea = Countries.Shipping_Area FROM Customer JOIN Address ON Customer.BillingAddressID = Address.AddressID JOIN Countries ON Address.CountryCode = Countries.Country_Code WHERE Customer.CustomerID = @CustomerID
SELECT
*
FROM
Shipping
WHERE
GeographicalCover = @ShippingArea
AND
WeightRangeLow > @ProductWeight
UNION
SELECT
*
FROM
Shipping
WHERE
GeographicalCover = @ShippingArea
AND
WeightRangeLow is Null
AND
WeightRangeHigh is Null
ORDER BY
ShippingCode
thanks
-Gus