Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ORDER BY in sp?
Message
From
23/05/2001 12:54:25
 
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Miscellaneous
Thread ID:
00510084
Message ID:
00510463
Views:
20
Sure. Here it is:
CREATE PROCEDURE sp_QZip_ZipSelection
   @QZipOrderID Int,
   @AreaID Int
AS
(
   SELECT A.QZipOrderID, A.QZipAreaOrderID, A.AreaID, B.Zip, C.MedianIncome,
      C.Total, C.QZip, D.QZipSelectionID, D.EstimatedQty, D.OrderQty
   FROM QZipAreaOrder A JOIN Zipcross B ON A.AreaID=B.AreaID
   LEFT JOIN HouseholdData C ON B.Zip=C.Zip
   LEFT JOIN QZipSelections D ON A.QZipAreaOrderID=D.QZipAreaOrderID 
      AND B.Zip=D.Zip
   WHERE A.QZipOrderID=@QZipOrderID
      AND A.AreaID=@AreaID 
   ORDER BY C.MedianIncome DESC
)
GO
FYI, the SP will work if I just strip off the ORDER BY clause. As I've stated at the start, I could run the same query, with the ORDER BY clause if I run the query in Query Analyzer.

>Would you post the whole stored procedure?
>
>-Mike
It's "my" world. You're just living in it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform