Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / January 2008

Tip: Looking for answers? Try searching our database.

Sort Question?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
C#Schroeder - 17 Jan 2008 17:04 GMT
I am new to SQL and am trying to sort some information.  The data is
being sorted, but not in the way I desire it to be.

Example:  Sorted Table                                   Desired Sort
    Product Name                                           Product
Name
------------------------------
-------------------------
   Test-1
Test-1
   Test-10
Test-2
   Test-11
Test-3
   Test-12
Test-4
   Test-2
Test-10
   Test-3
Test-11
   Test-4
Test-12

Thanks for any help.
C#Schroeder - 17 Jan 2008 17:06 GMT
On Jan 17, 11:04 am, "C#Schroeder" <Anthony.Schroe...@gray-
research.com> wrote:
> I am new to SQL and am trying to sort some information.  The data is
> being sorted, but not in the way I desire it to be.
[quoted text clipped - 20 lines]
>
> Thanks for any help.

Sorry Wrong forum.  I thought I was in the SQL forum.
Nicholas Paldino [.NET/C# MVP] - 17 Jan 2008 17:59 GMT
Anthony,

   Well, to answer your question, you are going to have to sort it based on
the numeric value after "Test-".

   If you know that the first five characters are always going to be
"Test-", then you can use this order by statement:

order by convert(int, right(<field>, len(<field>) - len("Test-")))

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

On Jan 17, 11:04 am, "C#Schroeder" <Anthony.Schroe...@gray-
research.com> wrote:
> I am new to SQL and am trying to sort some information. The data is
> being sorted, but not in the way I desire it to be.
[quoted text clipped - 20 lines]
>
> Thanks for any help.

Sorry Wrong forum.  I thought I was in the SQL forum.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.