I am using SQL Server 2000 and I will evaluate using LPAD and RPAD.
I ran into a further problem trying to pad in the select. I am
selecting the length of the string but what I really think I need is
the pixel length of the string.
I am adding the right number of spaces, but the columns still aren't
even :<(:! I think that it's because an "i" uses less space than an
"O". I am not sure that padding in the DB will work any differently.
Rick Mason
----- Original Message -----
From: Cornillon, Matthieu (Consultant) <[EMAIL PROTECTED]>
Date: Wed, 29 Sep 2004 12:01:24 -0400
Subject: RE: Order in multi-column select box
To: CF-Talk <[EMAIL PROTECTED]>
This is a long shot, but if you are pulling your from Oracle or another DB
that allows the LPAD/RPAD functions, you could pad it on the query instead
of having to loop through it. In fact, I often, when putting values like
this together in select statements, do all of the concatenation in the
query. Is this faster/slower? I don't know. It just turns out nicer,
easier-to-handle values.
If your columns are part number, dimensions, and cost, your query might look
like this:
SELECT LPAD(INV_PartNo,5), LPAD(INV_Height,4), LPAD(INV_Width,4),
LPAD(INV_Depth,4), LPAD(INV_Cost,7)
FROM INVENTORY
RPAD just pads on the right instead. If you want to pad with something
other than spaces, add it as a single-quote delimited third parameter to the
function. For example:
LPAD('dog',7,'R') returns RRRRdog.
HTH,
Matthieu
-----Original Message-----
From: Rick Mason [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 11:06 AM
To: CF-Talk
Subject: OT: Order in multi-column select box
I've had to build a select box with five columns for a current
project. How can I keep the columns in straight lines and not
displayed every which way?
I looked at some past code and I don't think I have ever done a select
with more than two columns displayed. It cries out for a table but I
can't do a table inside a select statement.
Short of looping through each column and adding enough spaces to make
them all equal to the largest record in the column I can't think of a
better way. Is there an easier method that I am missing?
Rick Mason
_____________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

