Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

store procedure

$
0
0

Hi all,

I have two stored procedure both of them working fine.I want to put their result into a table & join both stored procedure into one stored procedure & in one table as well.

Stored Procedured1:

create PROCEDURE StockAmounts
 @startdate datetime, @enddate datetime
AS
SELECT Location, Sum(Quantity) as current_quntity
FROM rel2
where rel2.datee BETWEEN @startdate and @enddate
GROUP BY Location
order by Location

Stored Procedured 2:

alter PROCEDURE prevQuantity
 @startdate date
AS
SELECT Location, Sum(Quantity) as closing_quantity
FROM rel2
WHERE datee < @startdate
GROUP BY Location
order by Location

Thnks


Gs



Viewing all articles
Browse latest Browse all 23857

Trending Articles