Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ordering
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Ordering
Divers
Thread ID:
00544830
Message ID:
00544830
Vues:
39
I'm just starting to work with SQLServer7 and have a basic question regarding ordering the result set within stored procedure from a passed parameter. The application is web based and I am allowing the users to sort data by clicking on the column header in my ASP page. This simple SP is below. All I am trying to do is use a SP and allow user to change the sort order by passing in a parameter to be used in the order by clause. If anyone can help I sure would appreciate. Thanks.

John.


CREATE PROCEDURE ProspectEntries @closedstat bit = 0, @recsort char(15) = 'p_city'
AS
SELECT prospects.prospect_id, prospects.prop_id, LOWER(prospects.address) address,
LOWER(prospects.p_city)+ ' ' City, RTRIM(LOWER(users.fname)) Firstname,
RTRIM(LOWER(users.lname)) LastName, RTRIM(LOWER(users.lname)) queryby,
prospects.checkeddate querydate, prospects.processed , prospects.comments,
prospects.processedby, prospects.processeddate
FROM prospects INNER JOIN users ON prospects.checkedby = users.keyid
WHERE processed = @closedstat
ORDER BY @recsort
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform