Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Proceedure does not return results "HELP"

Author  Topic 

pharoah35
Yak Posting Veteran

81 Posts

Posted - 2003-06-30 : 08:41:47
Good morning Ladies & Gents

The following Stored Proceedure had been returning results then sudenly stoped. Would you be able to decipher what may be incorrect with the sp

______________________________________________________________________
Alter Procedure sp_training_test (@Start_Date As DateTime, @End_Date As DateTime)
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
As



SELECT [HISTRY INV-LINE].INVOICE#,
[HISTRY INV-HEADER].[INVOICE-DATE],
[HISTRY INV-LINE].[QTY-SHP],
[IDEAS INVENTORY].[VNDR-ITEM#],
[IDEAS INVENTORY].[DESC] AS DESCRIPTION,
[HISTRY INV-LINE].[DLR-PRICE] / 100 AS [UNIT SALE],
[HISTRY INV-LINE].[QTY-SHP] * [HISTRY INV-LINE].[DLR-PRICE] / 100 AS [EXT SALE],
[HISTRY INV-LINE].[QTY-SHP] * ([HISTRY INV-LINE].[DLR-PRICE] / 100 - [HISTRY INV-LINE].[DLR-PRICE] / 100) AS PROFIT, @Start_Date, @End_Date
FROM dbo.[HISTRY INV-LINE] INNER JOIN
dbo.[HISTRY INV-HEADER] ON
dbo.[HISTRY INV-LINE].INVOICE# = dbo.[HISTRY INV-HEADER].INVOICE#
INNER JOIN
dbo.[IDEAS INVENTORY] ON
dbo.[HISTRY INV-LINE].DP# = dbo.[IDEAS INVENTORY].DP#
WHERE (dbo.[IDEAS INVENTORY].BRAND = 'training') AND
[HISTRY INV-HEADER].[INVOICE-DATE] >= @Start_Date AND
[HISTRY INV-HEADER].[INVOICE-DATE] <= @End_Date and
[HISTRY INV-LINE].[QTY-SHP] <> 0

ORDER BY [HISTRY INV-HEADER].[INVOICE-DATE], [HISTRY INV-LINE].INVOICE#

COMPUTE
SUM([HISTRY INV-LINE].[QTY-SHP] * [HISTRY INV-LINE].[DLR-PRICE] / 100),
SUM([HISTRY INV-LINE].[QTY-SHP] * [HISTRY INV-LINE].[DLR-PRICE] / 100),
SUM([HISTRY INV-LINE].[QTY-SHP] * ([HISTRY INV-LINE].[DLR-PRICE] / 100 - [HISTRY INV-LINE].[DLR-PRICE] / 100))
______________________________________________________________________
As always, Thanks in advance
pharoah35

mr_mist
Grunnio

1870 Posts

Posted - 2003-06-30 : 09:11:10
Does the query work if you run it from query analyzer without it being part of a procedure?

Are you sure there are invoices in the date range you are specifying?

What has changed?




-------
Moo.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-06-30 : 15:58:58
Its one of those damn miracle things again...

There are no miracles, because Mr. Mist is correct:

quote:

What has changed?



Either you changed code or data population doesn't meet your original reqs.

A bovine MOO to Mr. Mist

And a plain old MOO



Brett

8-)

EDIT: And what's with the spaces in the name and special chars?

Did you inherit this?



Edited by - x002548 on 06/30/2003 16:00:04
Go to Top of Page
   

- Advertisement -