Hi David,

Thank you again, your "logic" suggestions are a big improvement and I 
appreciate the mentoring.  I really think this sort of thing is what 
helps people who read lists like this, to learn more than just a 
quick answer, to learn to think better. 

I have a fundamental question about what you provided (I really want 
to understand this).  You have in the code:

------------

select top 100 percent
      /*  assuming tunit.unitid, tsection.sectid,
       *    tpage.pageid, and telement.elemid
       *    are all INT IDENTITY

[yes they are]

       *  Naming this RowHash for lack of a better term for this
       *  You can ORDER BY this field as well
       */
      convert(varbinary(4), tunit.unitid) +
      convert(varbinary(4), tunit.sectid) +
      convert(varbinary(4), tunit.pageid) +
      convert(varbinary(4), tunit.elemid) As RowHash,

                              [giant SNIP]

order by 
    tsection.unitseq,tpage.sectseq,telement.pageseq

---------------

I think it's cool the way you exampled how to do this, and that I 
could order by that 'created' field, w/those ID's all concatenated.

But those record IDs are just record ID's (row numbers).  These are 
not sequential in terms of the desired output of these records, only 
in terms of the storage in each of those original tables.  The 
records ARE going into this view in the correct sequence, but that 
sequence is not based on the ID values (as we see in the WHERE, as 
seq columns from three tables control the sequencing of the records 
in the newly created view). 

In the reality of the application, a sectid 2774 may come after 
sectid 101, and that goes for every level of the four IDs.  ... even 
were we ordering by that new value I don't see how this would work.  

It seems the combination of these rownums/IDs, which have no meaning 
except as the rownum for each of those table records, would create a 
scrambling of the sequence.

I've learned a lot just from your suggestions.  I don't see how that 
would work with my original need though --

Which is to create a vew that has its records ordered in a certain 
manner, and get a sequential value (rownum or index or something) as 
part of that view, so I have a unique and sequential key for the view 
table I can order by/ group on for following queries and outputs.

I apologize if I am dim-witted about this.  This rownum seems like a 
need in any created table, even temp or views (at least to me), and 
I'm confused about why this has to be so bleepin' hard.  I find it 
hard to believe I'm the first person to need such a thing.

The only thing I came up with on my own was doing an insert/select to 
a regular table from that view and creating a new identity field in 
the regular table, and or looping in an index step value.  This is 
seriously impractical as it would have to be done every time a report 
was needed as even QA data changes (in content and sequence).  This 
could take eons in the browser given the total records.  Creating the 
view gives me what I need.... except any 'reflection' of the sequence 
of records in the table that I can use as an order/group value.

Best regards,
I hope you are a patient man. :-)
Palyne


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to