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)
 Re: Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-13 : 11:03:52
Santosh writes "I would like to know how to use variables in Order By clause of stored procedures.
Here is the example :

CREATE PROCEDURE sp_GetCPDetails
(
@frmInput1 VarChar(100),
@frmInput2 VarChar(100),
@frmInput3 VarChar(100)
)
AS
Declare @frmInput4
set @frmInput4="1"
select distinct cp.CasepacketId as [CP ID],cp.Class, cp.Section,cc.Course_Title as [Course Title], cp.Prof1 as [Prof.] from CasePacket_Articles ca, Casepackets cp ,[Course catalog] cc, Articles a where ca.casepacketId=cp.casepacketid and cp.Term
in (@frmInput2,@frmInput3) and
cp.Class=cc.Course_id and ca.ArticleId=a.ArticleId and a.Copyright_src=@frmInput1 order by @frmInput4
GO

Please explain how to do this,

Thanks,
santosh"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-13 : 11:08:39
http://www.sqlteam.com/SearchResults.asp?SearchTerms=dynamic+order+by

Go to Top of Page
   

- Advertisement -