Can you give me a quick example of what the T-SQL would look like?
The way I currently have it, if I do not quote the sql var in the order by
statement it throws an error
thanks for your help
----- Original Message -----
From: "Paul Hastings" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 04, 2000 11:40 PM
Subject: Re: Stored procedures and dynamic ORDER BY


> > I have a huge record set that I want the client to be able to sort on
> which
>
> you have to use EXEC or sp_executesql to run dynamic sql code like
> that in an sp. you build the dynamic sql string, EXEC ("SELECT ...
> ORDER BY"+@horder)....sp_executesql in sql server 7 gives that
> code a chance of being cached.
>
> > order by '@horder'
>
> also just fyi, you never need to quote sql server vars
> like that, just plain @hOrder.
>
> --------------------------------------------------------------------------
----
> 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.
>

------------------------------------------------------------------------------
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