I have a huge record set that I want the client to be able to sort on which
ever column they choose.  Using CFQUERY I can dynamically set the ORDER BY
(eg.,):

<cfquery name="somequery" datasource="#attributes.datasource#">
SELECT      table1.*,table2.*
FROM         table1, table2
WHERE       table1.somekey = table2.somekey AND
                  (table1.someID = #client.someid#) AND
      (table1Date = '#client.thisdate#')
order by #client.order#
</cfquery>

The stored procedure seems to work fine, but the dynamic ORDER BY withing
does not (eg.,):

<CFSTOREDPROC PROCEDURE="someprocedure" datasource="#attributes.datasource#"
... RETURNCODE="YES" DEBUG>
<!--- CFPROCRESULT tags --->
<CFPROCRESULT NAME = somequery>
<!---  CFPROCPARAM tags --->
<CFPROCPARAM TYPE="IN" cfsqltype=CF_SQL_INTEGER
VALUE="#trim(client.someid)#" DBVARNAME=@caccountid>
<CFPROCPARAM TYPE="IN" cfsqltype=CF_SQL_VARCHAR VALUE="#trim(client.order)#"
DBVARNAME=@horder>
<CFPROCPARAM TYPE="IN" CFSQLTYPE=CF_SQL_VARCHAR
VALUE="#trim(client.thisdate)#" DBVARNAME=@thisdate>
<!--- Close the CFSTOREDPROC tag --->
</CFSTOREDPROC>


CREATE PROCEDURE someprocedure
@someid int,
@horder nchar(50),
@thisdate DateTime
AS

SELECT      table1.*,table2.*
FROM         table1, table2
WHERE       table1.somekey = table2.somekey AND
                  (table1.someID = @someid AND
      (table1Date = @thisdate)
order by '@horder'

What am I missing?



------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to