Re: Sequence

From: Mike (anonymous_at_discussions.microsoft.com)
Date: 08/18/04


Date: Wed, 18 Aug 2004 10:42:59 -0700

Hugo,

I don't have any data. I understand there is no 1st,2nd or
3rd record or so forth in relational database.

I have yet to create the table, etc. I am in design stage,
here is what I need ...

I will have a table - file type is one field and file
number is the other field,

I want to be able to assign field numbers based on file
type. These numbers should bear their own sequence
numbers. Like I already put in my previous email,
if the file type = 'A' the sequence will be A001,
A002, ...
if file type = 'B' the sequence will be B001, B002, ...

Hope this makes sense.

Thank you very much Hugo!
-Mike

>-----Original Message-----
>On Tue, 17 Aug 2004 14:38:27 -0700, Mike wrote:
>
>>I need to create sequence numbers for a column in a
table,
>>I wanted to find out how can I create it?
>>
>>I have a column, depending if the file type ='A'
>>the fileNumber should be 'A001'
>>The next record could have the file type='B', in this
>>case the filenumber should be 'B001',
>>if the next file type = 'A', the filenumber should be
>>'A002',
>>if the next file type = 'A', file number should
be 'A003',
>>if the next file type = 'B', file number should be
>>'B002', so on...
>>
>>I want to maintain more than one sequences for a column
>>and each one should preceed with an ALPHA.
>>What's the best way to do this?
>>
>>Remeber, I can't define it in EM as the sequence changes
>>with file type.
>>
>>Thanks in advance for your help!
>>-Mike
>
>Hi Mike,
>
>In a relational database, a table is by definition
UNordered. There is no
>such thing as a "first", "last" or "next" row. Those
terms only start
>making sense if they're put in the context of some
ordering: the first
>exployee sorted by age, the second-best selling
salesman, etc.
>
>If you have some way to decide why one A should be A001
and another should
>be 002 (and not vice versa), then I can help you. But
for that, I need the
>following information:
>
>* Table structure, posted as DDL (that is: CREATE TABLE
statements,
>including all constraints but omitting irrelevant
columns);
>* Sample data, posted as INSERT statements that I can
copy and paste into
>Query Analyzer to recreate your test data;
>* Expected output based on the provided sample data.
>
>
>Best, Hugo
>--
>
>(Remove _NO_ and _SPAM_ to get my e-mail address)
>.
>



Relevant Pages

  • Re: Doubling the order
    ... The early SQLs were based on existing file systems. ... relational database and it is not the best one. ... the gap in the sequence is not filled in and the sequence ... Since a query result is a table, and a table is a set which has no ...
    (microsoft.public.sqlserver.programming)
  • Sequence
    ... I need to create sequence numbers for a column in a table, ... depending if the file type ='A' ... case the filenumber should be 'B001', ...
    (microsoft.public.sqlserver.mseq)