written quite a bit this year.
If memory serves me, you can't do conditionals in the middle of a
query. You'll have to replicate the whole query.
I wonder if something like this might be better as a view. Then you
could select on the view and sort it as necessary in CF.
At 06:30 PM 9/10/2004, you wrote:
>Why wont something like this work? is there a way to do something like
>this in a stored procedure?
>
>CREATE PROCEDURE [dbo].[fa_users_inout]
> AS
>DECLARE @sortfield int
>DECLARE @sorttype varchar(4)
> SELECT
> a.LastName
> , a.FirstName
> , a.UserName
> , a.Password
> , a.ID
> , a.ActiveStatus
> , a.ClientDisplayable
> , b.Location as location
> , c.userlevel as newuserlevel
> FROM
> abPartnerUsers a INNER
> JOIN abPartnerLocation b ON a.LocationID = b.ID
> JOIN faPermissions c ON a.PermissionsID = c.ID
> ORDER BY
> IF @sortfield = 1
> BEGIN
> LastName @sorttype, FirstName
> END
> ELSE IF @sortfield = 2
> BEGIN
> FirstName @sorttype, LastName
> END
> ELSE IF @sortfield = 3
> BEGIN
> username @sorttype, LastName, FirstName
> END
> ELSE IF @sortfield = 4
> BEGIN
> password @sorttype, LastName, FirstName
> END
> ELSE IF @sortfield = 5
> BEGIN
> location @sorttype, LastName, FirstName
> END
> ELSE IF @sortfield = 6
> BEGIN
> newuserlevel @sorttype, LastName, FirstName
> END
> ELSE IF @sortfield = 7
> BEGIN
> ActiveStatus @sorttype, LastName, FirstName
> END
> ELSE
> BEGIN
> LastName desc
> END
>GO
--
Jeffry Houser, Web Developer, Writer, Songwriter, Recording Engineer
<mailto:[EMAIL PROTECTED]>
--
AIM: Reboog711 | Phone: 1-203-379-0773
--
My Books: <http://www.instantcoldfusion.com>
Recording Music: <http://www.fcfstudios.com>
Original Energetic Acoustic Rock: <http://www.farcryfly.com>
--
When did Reality Become TV
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
