Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ORDER BY in sp?
Message
 
 
À
23/05/2001 08:05:17
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Divers
Thread ID:
00510084
Message ID:
00510463
Vues:
22
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform