ALTER PROCEDURE spGetTotals -- Add the parameters for the stored procedure here @Id uniqueidentifier AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here Declare @SubTotal Decimal(10,2) SET @SubTotal = (SELECT SUM(Cost) From InvoiceItem WHERE InvoiceId =@Id) SET @SubTotal += (SELECT SUM(Charges) From Invoice_ExtraCharge WHERE InvoiceId=@Id) CREATE TABLE #TaxAmount ( TaxName varchar(50), Charge Decimal(10,2) ); --using stored procedure INSERT INTO #TaxAmount EXEC spGetTaxAmountForTallyByInvoiceId @Id; select * from #TaxAmount DECLARE @Total As Decimal(12,2) SET @Total = @SubTotal-- + (SELECT SUM(Charge) FROM #TaxAmount) Select @SubTotal As SubTotal,@Total AS Total END GO
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)