I am having a problem with this SP. What I am wanting to do is get a value "@quantity" from one SP and use it in the select of this SP. The problem is that the select that uses the "@quantity does not return my information. I have verified the "@quantity" value and it is correct. If I hard code "@quantity" with a value everything works fine.
@jobnumber varchar(10)
--@quantity int
AS
BEGIN
declare @quantity int
declare @qty int
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
exec @quantity = fs_get_qty @jobnumber
-- Insert statements for procedure here
SELECT dbo.estimateqtytable.JobNumber, estimatenumber,sum(stockprice) as estpapercost
FROM dbo.estimateqtytable
WHERE (dbo.estimateqtytable.jobnumber=@jobnumber) and dbo.estimateqtytable.quantity=@quantity
--WHERE (dbo.estimateqtytable.jobnumber=@jobnumber) and dbo.estimateqtytable.quantity=(select OrderedQuantity from dbo.fs_get_qty(@jobnumber))
GROUP BY dbo.estimateqtytable.JobNumber,estimatenumber
END
@jobnumber varchar(10)
--@quantity int
AS
BEGIN
declare @quantity int
declare @qty int
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
exec @quantity = fs_get_qty @jobnumber
-- Insert statements for procedure here
SELECT dbo.estimateqtytable.JobNumber, estimatenumber,sum(stockprice) as estpapercost
FROM dbo.estimateqtytable
WHERE (dbo.estimateqtytable.jobnumber=@jobnumber) and dbo.estimateqtytable.quantity=@quantity
--WHERE (dbo.estimateqtytable.jobnumber=@jobnumber) and dbo.estimateqtytable.quantity=(select OrderedQuantity from dbo.fs_get_qty(@jobnumber))
GROUP BY dbo.estimateqtytable.JobNumber,estimatenumber
END