<font size=1 color=#800080 face="sans-serif">----- Forwarded by Allan
Biggs/GB/CONT/DPT on 06/02/2017 17:03 -----</font>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Allan Biggs/GB/CONT/DPT</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">martin.bowes@ndph.ox.ac.uk</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">06/02/2017 16:51</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: [Info-ingres]
One up unique number for an attribute - in SQL - does anyone know the trick
of doing this?</font>
<br>
<hr noshade>
<br>
<br><font size=2 face="sans-serif">Martin,</font>
<br>
<br><font size=2 face="sans-serif">In the example below is there a way
of making it order by test_id [ascending or descending] as you can
see the sorting breaks down at sort_order 4,5,6 and later as well'</font>
<br><font size=2 face="sans-serif">I did try order by in the insert knowing
that is illegal -<b> it is :-)</b> </font>
<br>
<br><font size=2 face="sans-serif">I also tried heapsort instead of btree
on test_id - but that gave a similar result !!</font>
<br>
<br><font size=2 face="sans-serif">Thanks</font>
<br><font size=2 face="sans-serif">Allan </font>
<br>
<br>
<br>
<br>
<br>
<br><font size=4 face="Courier New">drop wrr2tests_w_asd;</font>
<br><font size=4 face="Courier New">Executing . . .</font>
<br>
<br><font size=4 face="Courier New">continue</font>
<br><font size=4 face="Courier New">* * * * * * * * * * * * * * * * * *
* *</font>
<br><font size=4 face="Courier New">create table wrr2tests_w_asd</font>
<br><font size=4 face="Courier New">( page_id integer not
null with default,</font>
<br><font size=4 face="Courier New"> test_id integer
not null with default,</font>
<br><font size=4 face="Courier New"> sort_order integer generated
always as identity (start with 1 increment by 1)</font>
<br><font size=4 face="Courier New">);</font>
<br><font size=4 face="Courier New">modify wrr2tests_w_asd to btree on
test_id ;</font>
<br>
<br><font size=4 face="Courier New">insert into wrr2tests_w_asd</font>
<br><font size=4 face="Courier New">( page_id ,</font>
<br><font size=4 face="Courier New"> test_id )</font>
<br><font size=4 face="Courier New">select</font>
<br><font size=4 face="Courier New">page_id ,</font>
<br><font size=4 face="Courier New"> test_id</font>
<br><font size=4 face="Courier New">from</font>
<br><font size=4 face="Courier New">sspgcerttests_t_asd</font>
<br><font size=4 face="Courier New">;</font>
<br>
<br>
<br><font size=4 face="Courier New">Executing . . .</font>
<br>
<br><font size=4 face="Courier New">(0 rows)</font>
<br><font size=4 face="Courier New">(32 rows)</font>
<br><font size=4 face="Courier New">continue</font>
<br><font size=4 face="Courier New">* * * * *</font>
<br>
<br><font size=4 face="Courier New">select * from wrr2tests_w_asd order
by sort_order ;</font>
<br>
<br><font size=4 face="Courier New">Executing . . .</font>
<br>
<br>
<br><font size=4 face="Courier New">+-------------+-------------+-------------+</font>
<br><font size=4 face="Courier New">|page_id |test_id
|sort_order |</font>
<br><font size=4 face="Courier New">+-------------+-------------+-------------+</font>
<br><font size=4 face="Courier New">| 1696|
1688| 1|</font>
<br><font size=4 face="Courier New">| 1696|
1687| 2|</font>
<br><font size=4 face="Courier New">| 1696|
1638| 3|</font>
<br><font size=4 face="Courier New">| 1696|
1637| 4|</font>
<br><font size=4 face="Courier New">| 1696|
1410| 5|</font>
<br><font size=4 face="Courier New">| 1696|
1405| 6|</font>
<br><font size=4 face="Courier New">| 1696|
1407| 7|</font>
<br><font size=4 face="Courier New">| 1696|
1402| 8|</font>
<br><font size=4 face="Courier New">| 1696|
1409| 9|</font>
<br><font size=4 face="Courier New">| 1696|
1404| 10|</font>
<br><font size=4 face="Courier New">| 1696|
1399| 11|</font>
<br><font size=4 face="Courier New">| 1696|
1398| 12|</font>
<br><font size=4 face="Courier New">| 1696|
1397| 13|</font>
<br><font size=4 face="Courier New">| 1696|
1396| 14|</font>
<br><font size=4 face="Courier New">| 1696|
1395| 15|</font>
<br><font size=4 face="Courier New">| 1696|
1356| 16|</font>
<br><font size=4 face="Courier New">| 1696|
1355| 17|</font>
<br><font size=4 face="Courier New">| 1696|
1354| 18|</font>
<br><font size=4 face="Courier New">| 1696|
1332| 19|</font>
<br><font size=4 face="Courier New">| 1696|
1394| 20|</font>
<br><font size=4 face="Courier New">| 1696|
1393| 21|</font>
<br><font size=4 face="Courier New">| 1696|
1392| 22|</font>
<br><font size=4 face="Courier New">| 1696|
1391| 23|</font>
<br><font size=4 face="Courier New">| 1696|
1390| 24|</font>
<br><font size=4 face="Courier New">| 1696|
1353| 25|</font>
<br><font size=4 face="Courier New">| 1696|
1352| 26|</font>
<br><font size=4 face="Courier New">| 1696|
1351| 27|</font>
<br><font size=4 face="Courier New">| 1696|
1331| 28|</font>
<br><font size=4 face="Courier New">| 1696|
1114| 29|</font>
<br><font size=4 face="Courier New">| 1696|
1112| 30|</font>
<br><font size=4 face="Courier New">| 1696|
1102| 31|</font>
<br><font size=4 face="Courier New">| 1696|
1101| 32|</font>
<br><font size=4 face="Courier New">+-------------+-------------+-------------+</font>
<br><font size=4 face="Courier New">(32 rows)</font>
<br><font size=4 face="Courier New">continue</font>
<br><font size=4 face="Courier New">* * * * *</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Allan Biggs <Allan.Biggs@GBR.dupont.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">martin.bowes@ndph.ox.ac.uk</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">"info-ingres@lists.planetingres.org"
<info-ingres@lists.planetingres.org></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">06/02/2017 16:10</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: [Info-ingres]
One up unique number for an attribute - in SQL - does anyone know the trick
of doing this?</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Sent by:
</font><font size=1 face="sans-serif">info-ingres-bounces@lists.planetingres.org</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=2 face="sans-serif">Martin,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Thanks for this - I don't have 10.2 documentation on my PC and the ESD
site seems to be down or very busy this afternoon so was unable to look
it up.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
The number of times I have needed to do this and struggled with internal
procedures :-) </font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
cheers <br>
Allan</font><font size=3> <br>
<br>
<br>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
From: </font><font size=1 face="sans-serif">Martin
Bowes <martin.bowes@ndph.ox.ac.uk></font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
To: </font><font size=1 face="sans-serif">Allan
Biggs <Allan.Biggs@GBR.dupont.com></font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Cc: </font><font size=1 face="sans-serif">"info-ingres@lists.planetingres.org"
<info-ingres@lists.planetingres.org></font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Date: </font><font size=1 face="sans-serif">06/02/2017
15:47</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Subject: </font><font size=1 face="sans-serif">RE:
[Info-ingres] One up unique number for an attribute - in SQL - does anyone
know the trick of doing this?</font><font size=3> <br>
</font>
<hr noshade><font size=3><br>
<br>
</font><font size=2 color=#004080 face="Calibri"><br>
Create the table using an identity column or have the column take a column
default which is the next value from a sequence.</font><font size=3> </font><font size=2 color=#004080 face="Calibri"><br>
</font><font size=3> </font><font size=2 color=#004080 face="Calibri"><br>
Martin Bowes</font><font size=3> </font><font size=2 color=#004080 face="Calibri"><br>
</font><font size=3> </font><font size=2 face="Tahoma"><b><br>
From:</b> Allan Biggs [</font><a href=mailto:Allan.Biggs@GBR.dupont.com><font size=2 color=blue face="Tahoma"><u>mailto:Allan.Biggs@GBR.dupont.com</u></font></a><font size=2 face="Tahoma">]
<b><br>
Sent:</b> 06 February 2017 15:42<b><br>
To:</b> info-ingres@lists.planetingres.org; openroad-users@googlegroups.com<b><br>
Subject:</b> [Info-ingres] One up unique number for an attribute - in SQL
- does anyone know the trick of doing this?</font><font size=3> </font><font size=3 face="Times New Roman"><br>
</font><font size=3> </font><font size=2 face="Arial"><br>
in command line sql I am populating a new table - one of the columns is
a sort order <br>
<br>
each row of this field <b><u>must</u></b> be a 'one up' unique number
starting at 1 and ending as the number of rows in the table </font><font size=3 face="Times New Roman">
<br>
</font><font size=2 face="Arial"><br>
<br>
I know that I could do this in OpenROAD , and in another guise this is
done in OpenROAD, but in this case it has to be done in SQL or maybe
in report writer.</font><font size=3 face="Times New Roman"> </font><font size=2 face="Arial"><br>
<br>
It does not matter which rows contain 1 ,2 etc although one
of the columns does have a set of unique numbers with gaps which could
be used to determine the order of row 1, 2 etc. </font><font size=3 face="Times New Roman">
</font><font size=2 face="Arial"><br>
<br>
Does anyone know of a 'trick' to do this?</font><font size=3 face="Times New Roman">
</font><font size=2 face="Arial"><br>
<br>
In mysql it is possible to define unique one up numbers when creating a
table does modern Ingres have this feature?</font><font size=3 face="Times New Roman">
</font><font size=2 face="Arial"><br>
<br>
thanks <br>
Allan </font><font size=3> </font>
<p><font size=3 face="Times New Roman"><br>
This communication is for use by the intended recipient and contains<br>
information that may be Privileged, confidential or copyrighted under<br>
applicable law. If you are not the intended recipient, you are hereby<br>
formally notified that any use, copying or distribution of this e-mail,<br>
in whole or in part, is strictly prohibited. Please notify the sender by<br>
return e-mail and delete this e-mail from your system. Unless explicitly<br>
and conspicuously designated as "E-Contract Intended", this e-mail
does<br>
not constitute a contract offer, a contract amendment, or an acceptance<br>
of a contract offer. This e-mail does not constitute a consent to the<br>
use of sender's contact information for direct marketing purposes or for<br>
transfers of data to third parties.</font><font size=3> </font>
<p><font size=3 face="Times New Roman">Francais Deutsch Italiano Espanol
Portugues Japanese Chinese Korean</font><font size=3>
</font>
<p><font size=3 face="Times New Roman">
</font><a href=http://www.dupont.com/corp/email_disclaimer.html><font size=3 color=blue face="Times New Roman"><u>http://www.DuPont.com/corp/email_disclaimer.html</u></font></a><font size=3>
</font>
<p><font size=3><br>
This communication is for use by the intended recipient and contains<br>
information that may be Privileged, confidential or copyrighted under<br>
applicable law. If you are not the intended recipient, you are hereby<br>
formally notified that any use, copying or distribution of this e-mail,<br>
in whole or in part, is strictly prohibited. Please notify the sender by<br>
return e-mail and delete this e-mail from your system. Unless explicitly<br>
and conspicuously designated as "E-Contract Intended", this e-mail
does<br>
not constitute a contract offer, a contract amendment, or an acceptance<br>
of a contract offer. This e-mail does not constitute a consent to the<br>
use of sender's contact information for direct marketing purposes or for<br>
transfers of data to third parties.</font>
<p><font size=3>Francais Deutsch Italiano Espanol Portugues
Japanese Chinese Korean</font>
<p><font size=3> </font><a href=http://www.dupont.com/corp/email_disclaimer.html><font size=3>http://www.DuPont.com/corp/email_disclaimer.html</font></a><tt><font size=2>_______________________________________________<br>
Info-ingres mailing list<br>
Info-ingres@lists.planetingres.org<br>
</font></tt><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.planetingres.org_mailman_listinfo_info-2Dingres&d=DwICAg&c=zRqMG_fghhK--2M6Q5UUdA&r=NR3Ih16COg3iVzf1V6AnysHgZxJHe-pkPnBl5lbRPSY&m=3TRWI_SdqoEFSGsaGPVNrYFAj-iNOI5Hh5ejTQBhgw0&s=dtdelW38-9MDir9yps2RH3oMCDRk6AMy6P3NvlOOuVE&e="><tt><font size=2>https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.planetingres.org_mailman_listinfo_info-2Dingres&d=DwICAg&c=zRqMG_fghhK--2M6Q5UUdA&r=NR3Ih16COg3iVzf1V6AnysHgZxJHe-pkPnBl5lbRPSY&m=3TRWI_SdqoEFSGsaGPVNrYFAj-iNOI5Hh5ejTQBhgw0&s=dtdelW38-9MDir9yps2RH3oMCDRk6AMy6P3NvlOOuVE&e=</font></tt></a><tt><font size=2>
<br>
</font></tt>
<p><p><br>
This communication is for use by the intended recipient and contains<br>
information that may be Privileged, confidential or copyrighted under<br>
applicable law. If you are not the intended recipient, you are hereby<br>
formally notified that any use, copying or distribution of this e-mail,<br>
in whole or in part, is strictly prohibited. Please notify the sender by<br>
return e-mail and delete this e-mail from your system. Unless explicitly<br>
and conspicuously designated as "E-Contract Intended", this e-mail does<br>
not constitute a contract offer, a contract amendment, or an acceptance<br>
of a contract offer. This e-mail does not constitute a consent to the<br>
use of sender's contact information for direct marketing purposes or for<br>
transfers of data to third parties.</p>
<p>Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean</p>
<p> http://www.DuPont.com/corp/email_disclaimer.html</p>