: ORDER BY (SQL
Server)
12/20/01
Use decimal or numeric for the data type.
At 09:34 AM 12/20/2001 -0500, you wrote:
>I have noticed when using an ORDER BY clause that my list sorts on first
>digit of a number and not the whole number. Does the data type definition
in
>my database have any impact on the sort?
>
>Sorts like this
Yes, that works. Thanks!
-Original Message-
From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 9:55 AM
To: CF-Talk
Subject: RE: ORDER BY (SQL Server)
That is because your data type is set to a character type... use cast to
change it...
select cName
, 2001 9:55 AM
To: CF-Talk
Subject: Re: ORDER BY (SQL Server)
James,
Looks like your data type is text, in which case the order you have is
correct.
Changing the data type to numeric will order them in the correct numeric
order.
Regards
Stephen
- Original Message -
From: "James T
James,
Looks like your data type is text, in which case the order you have is
correct.
Changing the data type to numeric will order them in the correct numeric
order.
Regards
Stephen
- Original Message -
From: "James Taavon" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: T
That is because your data type is set to a character type... use cast to
change it...
select cName, cSSN, cZipCode, CAST(Left(cZipCode, 5) AS INT) from
Informaiton order by CAST(Left(cZipCode, 5) AS INT)
HTH
C. Hatton Humphrey, Developer
Fisher, Towne & Associates
716-839-2141 x336
[EMAIL PROTE
Change the field type of the field to integer
Then your sort will work fine. Right now I am
Sure it is text or varchar thus the sorting you
Indicated is correct for varchar or text.
-Original Message-
From: James Taavon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 9:35 A
7 matches
Mail list logo