This is the sort of thing that's probably best done at the database level with
TransactSQL, but just for fun I wrote up a JScript script. Here's the gist of
it:
----------------------------------------
var args = WScript.Arguments;
var tempArray = new Array();
var inputString, outputString = "";
if (args.length > 0)
{
inputString = args(0);
}
else
{
WScript.Quit();
}
tempArray = inputString.split(" ");
tempArray = tempArray.sort();
for (i = 0; i < tempArray.length; i++)
{
if (tempArray[i] != null)
{
outputString += tempArray[i];
}
if (i == tempArray.length - 1)
{
break;
}
outputString += " ";
}
WScript.Echo(outputString);
----------------------------------------
To run it, you use the cscript command:
>cscript /nologo sort_strings.js "010 007 004 030 029"
004 007 010 029 030
>
Of course, Microsoft just loves to add carriage returns, so after the filter
Set Fields $PROCESS$ action, you'd have to chop them off.
Naturally, if this were Unix, or if the Windows SysAdmin were "enlightened,"
we'd use Perl.
--Tim
--- "Carnevali, Carol x23849" <[EMAIL PROTECTED]> wrote:
> Does anyone know how to sort a string of numbers that exist in a character
> field? For example:
>
> 010 007 004 030 029
>
> I would want this to sort as:
>
> 004 007 010 029 030
>
>
> Thanks!
> Carol
>
> ARS 7.0.1 patch 2
> SQL 2000
>
> This message and any attachments are intended only for the use of the
> addressee and
> may contain information that is privileged and confidential. If the reader of
> the
> message is not the intended recipient or an authorized representative of the
> intended recipient, you are hereby notified that any dissemination of this
> communication is strictly prohibited. If you have received this communication
> in
> error, please notify us immediately by e-mail and delete the message and any
> attachments from your system.
>
>
_______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the
> Answers Are"
>
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the
Answers Are"