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.
| Author |
Topic |
|
jrockfl
Posting Yak Master
223 Posts |
Posted - 2004-10-28 : 10:00:09
|
| I created this procedure, but it doesnt return any results when I execute it. If i hardcode the cus_no in a query, it works fine.Also, the value for the cus_no will be the same in both queries.CREATE PROCEDURE Product_Predictor (@arg_Cus_No VARCHAR(255))ASBEGINSELECT Item_No AS Item_Number, request_dt AS Request_Date, SUM(qty_Ordered) AS Quantity_OrderedFROM OELINHST_SQLWHERE (Cus_No = '@arg_Cus_No') AND (Ord_Type = 'O') AND (Qty_Bkord = '0') AND item_no IN (SELECT item_no FROM OELINHST_SQL WHERE Cus_No = '@arg_Cus_No'AND Ord_Type = 'o'AND Qty_Bkord = '0'GROUP BY item_no HAVING count(item_no) > 2)GROUP BY item_no, request_dtORDER BY item_no DESCEND;GO |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-28 : 10:06:35
|
change WHERE Cus_No = '@arg_Cus_No'toWHERE Cus_No = @arg_Cus_NoGo with the flow & have fun! Else fight the flow |
 |
|
|
jrockfl
Posting Yak Master
223 Posts |
Posted - 2004-10-28 : 10:10:38
|
| That worked. Thank you. Why does that work though? cus_no is varchar. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-28 : 10:16:03
|
becauseWHERE Cus_No = '@arg_Cus_No'will look for cus_no that has the value of '@arg_Cus_No'WHERE Cus_No = @arg_Cus_Nowill look for cus_no that has the value stored in variable @arg_Cus_NoGo with the flow & have fun! Else fight the flow |
 |
|
|
jrockfl
Posting Yak Master
223 Posts |
Posted - 2004-10-28 : 10:28:07
|
| Ok..got it! Thanks |
 |
|
|
|
|
|