Dear All,I have tableCREATE TABLE [dbo].[tbshipping]( [id] [bigint] IDENTITY(1,1) NOT NULL, [fromcountryid] [bigint] NULL, [tocountryid] [bigint] NULL, [fromStateID] [bigint] NULL, [toStateID] [bigint] NULL, [fromkg] [float] NULL, [tokg] [float] NULL, [additional] [float] NULL, [addWeight] [float] NULL, [addAmount] [money] NULL, [Amount] [money] NULL, [shortcode] [varchar](50) NULL, [type] [varchar](20) NULL, [addby] [varchar](50) NULL, [adddate] [datetime] NULL, [editby] [varchar](50) NULL, [editdate] [datetime] NULL, CONSTRAINT [PK_tbshipping] PRIMARY KEY CLUSTERED ( [id] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
I want SP to calculate the ahipping amount. Anyone have idea on how to do it?Create proc spGetShippingCharges( --spGetShippingCharges 130,130,1397,1400,1500 @fromcountryid int, @tocountryid int, @fromstateid int, @tostateid int, @totalweight float ) as set nocount on begin SELECT bal=(tokg-@totalweight) << if bal negative mean ShipAmt=abs(balance/[addWeight])*addAMount + @totalweight*amount >><< if bal positive mean ShipAmt=@totalweight*amount >> FROM [dbo].[tbshipping] where fromcountryid = @fromcountryid and tocountryid=@tocountryid end set nocount offPlease advise.Thank you.Regards,Micheale