<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Theoretically you can. What I don’t know is whether the Valentina Engine already supports it.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">The sequence generator has been added to vStudio in order to support the Postgresql engine.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">In Postgresql you would do</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">add field vessel_nr serial (or big serial).</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">This is shorthand for</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">add field vessel_nr integer (or bigint) unique</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">create sequence seq_vessel_nr</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">set default value of field vessel_nr to nextval(seq_vessel_nr)</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">so now you have a field vessel_nr with an autoincrementing value on every insert (creation of vessel trip?)</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">the only thing left to do is , if you already have data in your vessel table, generate numbers for the existing values.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">And the last thing to do is set the startvalue of seq_vessel_nr to max(vessel_nr)+1.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">From hereon your vessel_nr will autoincrement with the correct number</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">hth</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">bart</div> <div id="bloop_sign_1388785417793828096" class="bloop_sign"><span style="font-family:helvetica,arial;font-size:13px"></span>— <div><div apple-content-edited="true"><div style="font-family: Helvetica; font-size: medium; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="margin: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px;"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><b><i><u><span lang="EN-US" xml:lang="EN-US" style="font-size: 10pt; font-family: 'Century Gothic', sans-serif; color: red;">Our office will be closed on:</span></u></i></b></span></div><div style="margin: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px;"><b><i><span style="font-size: 10pt; font-family: 'Century Gothic', sans-serif; color: red;">24 (afternoon) - <a href="tel://25 - 31/12/2013">25 - 31/12/2013</a> & <a href="http://airmail.calendar/2014-01-01%2012:00:00%20GMT+1">01/01/2014</a></span></i></b></div></div></div></div></div></div><div><br>Bart Pietercil<br><span>Sent with aMac</span></div></div> <br><p style="color:#A0A0A8;">On 3 Jan 2014 at 16:47:59, william humphrey (<a href="mailto://bill@bluewatermaritime.com">bill@bluewatermaritime.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div>Can that kind of create sequence be done after the fact of table
<br>finished and data already in?
<br>
<br>On Fri, Jan 3, 2014 at 11:23 AM, Ruslan Zasukhin
<br><ruslan_zasukhin@valentina-db.com> wrote:
<br>> On 1/3/14, 4:46 PM, "william humphrey" <bill@bluewatermaritime.com> wrote:
<br>>
<br>>> I've been thinking that a sequence maintained with a trigger might be
<br>>> very useful for other things too. I never thought of numbering
<br>>> sequentially the voyages of each vessel. It solves some other
<br>>> problems. Right now voyage numbers increment from zero at the start of
<br>>> each new year (which is what caused the problem) but there is no
<br>>> reason why I can't have an extra field which has every voyage for that
<br>>> vessel down through the years.
<br>>
<br>> Do you talk about CERATE SEQUENCE?
<br>>
<br>>
<br>> For simple case, consider SERIAL32 or SERIAL64 pseudo-types,
<br>> As even more simple things.
<br>>
<br>>
<br>> --
<br>> Best regards,
<br>>
<br>> Ruslan Zasukhin
<br>> VP Engineering and New Technology
<br>> Paradigma Software, Inc
<br>>
<br>> Valentina - Joining Worlds of Information
<br>> http://www.paradigmasoft.com
<br>>
<br>> [I feel the need: the need for speed]
<br>>
<br>>
<br>> _______________________________________________
<br>> Valentina mailing list
<br>> Valentina@lists.macserve.net
<br>> http://lists.macserve.net/mailman/listinfo/valentina
<br>
<br>
<br>
<br>--
<br>http://www.bluewatermaritime.com
<br>_______________________________________________
<br>Valentina mailing list
<br>Valentina@lists.macserve.net
<br>http://lists.macserve.net/mailman/listinfo/valentina
<br></div></div></span></blockquote></body></html>