Unix Technical Forum

sorting based on various data types

This is a discussion on sorting based on various data types within the SQL Server forums, part of the Microsoft SQL Server category; --> I've been tasked with designing a database to store collective agreements. I need to store each sub-article of each ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 08:05 AM
Josh
 
Posts: n/a
Default sorting based on various data types

I've been tasked with designing a database to store collective
agreements. I need to store each sub-article of each article of each
agreement in it's own row within a table. I'm having difficulty
figuring out the best way to store each sub-article's identifier so
they sort properly.

The majority of the collective agreements use numbers in a dotted
notation, for example:

1.1
1.2
1.3.1
1.3.2
1.3.3
1.4

Some agreements mix letters with numbers, such as:

A-1.1
1.1.A.1

Any ideas how I should deal with this?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 08:05 AM
Robin Tucker
 
Posts: n/a
Default Re: sorting based on various data types

Use fixed length fields for each number in your "path string", ie:

0001.0001
0001.0002
0001.0003.0001
0001.0003.0002
0001.0003.0003
0001.0004
0A-1.0001
0001.0001.000A.0001

Converting the path is simply a case of removing leading "0" after each
fullstop. This should sort correctly.


"Josh" <jpiche@caut.ca> wrote in message
news:1119356513.427410.173150@z14g2000cwz.googlegr oups.com...
> I've been tasked with designing a database to store collective
> agreements. I need to store each sub-article of each article of each
> agreement in it's own row within a table. I'm having difficulty
> figuring out the best way to store each sub-article's identifier so
> they sort properly.
>
> The majority of the collective agreements use numbers in a dotted
> notation, for example:
>
> 1.1
> 1.2
> 1.3.1
> 1.3.2
> 1.3.3
> 1.4
>
> Some agreements mix letters with numbers, such as:
>
> A-1.1
> 1.1.A.1
>
> Any ideas how I should deal with this?
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 08:05 AM
Josh
 
Posts: n/a
Default Re: sorting based on various data types

That's much simpler than the ideas I had. Thanks!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 08:07 AM
--CELKO--
 
Posts: n/a
Default Re: sorting based on various data types

You should be using a document management tools for documents. And
this is coming from an SQL fanatic!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 08:09 AM
Josh
 
Posts: n/a
Default Re: sorting based on various data types

We're planning to create a system that will compare articles from many
different agreements and will link articles and sub-articles to a
subject index. Users will then be able to pull up contract language
from various agreements that deal with the specific subject they are
interested in. We have a document management system here, but it
certainly can't do this. Are you aware of other document management
tools I should look at?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:53 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com