On Tue, 24 Jun 2014 21:02:22 +0100
Dave Wellman dwell...@ward-analytics.com wrote:
2) Assuming that my processing follows this pattern: empty table
T1 completely, insert a number of rows, insert/select from T1 into
T2. On the 'select' processing will the 'rowid'
** always ** start at 1?
-Ursprüngliche Nachricht-
Von: RSmith [mailto:rsm...@rsweb.co.za]
Gesendet: Mittwoch, 25. Juni 2014 21:54
An: sqlite-users@sqlite.org
Betreff: Re: [sqlite] Sequential numbers
On 2014/06/25 21:38, Dave Wellman wrote:
Hi Petite,
Many thanks fo rthsuggestion, it works a treat!.
Hi
Hi Dave,
You can of course also calculate a new sequence number based on the row ids.
Just count the number of records with a smaller or equal rowid. This way it
doesn't matter if rowid starts at 1 or if there are any gaps in the range.
Example:
CREATE TABLE aaa (i, seqnr);
INSERT INTO
Op 26 jun 2014, om 10:32 heeft Rob Golsteijn het volgende geschreven:
Hi Dave,
You can of course also calculate a new sequence number based on the
row ids. Just count the number of records with a smaller or equal
rowid. This way it doesn't matter if rowid starts at 1 or if there
are any
Example:
CREATE TABLE aaa (i, seqnr);
INSERT INTO aaa VALUES(10,NULL);
INSERT INTO aaa VALUES(20,NULL);
INSERT INTO aaa VALUES(50,NULL);
INSERT INTO aaa VALUES(30,NULL);
INSERT INTO aaa VALUES(20,NULL);
UPDATE aaa SET seqnr=(SELECT count() FROM aaa smaller where
smaller.rowid =
: [sqlite] Sequential numbers
On Jun 24, 2014, at 10:47 PM, Dave Wellman dwell...@ward-analytics.com
wrote:
I need the values to be sequential.
Well. if your data set is as small as you mentioned (20 records or less).
you could roll your own numbering schema with the simple expedient
: 3917021 Registered in England and Wales.
-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Petite Abeille
Sent: 24 June 2014 21:57
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Sequential numbers
On Jun 24
On 2014/06/25 21:38, Dave Wellman wrote:
Hi Petite,
Many thanks fo rthsuggestion, it works a treat!.
Hi Simon,
Thanks for the thoughts but in this particular processing that is not going
to happen (delete a few rows). In this processing we always empty the table
completely before re-populating
Hi all,
I have some rows in a table (not very many, typically less than 20) and I
want to generate a unique, sequential number for each row. In another dbms
I've used a row_number function (amongst others) to achieve this but I can't
see anything with equivalent functionality in sqlite3. My
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 24/06/14 13:02, Dave Wellman wrote:
I have some rows in a table (not very many, typically less than 20) and
I want to generate a unique, sequential number for each row.
http://www.sqlite.org/autoinc.html
Roger
-BEGIN PGP SIGNATURE-
Database
Subject: Re: [sqlite] Sequential numbers
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 24/06/14 13:02, Dave Wellman wrote:
I have some rows in a table (not very many, typically less than 20)
and I want to generate a unique, sequential number for each row.
http://www.sqlite.org
On Jun 24, 2014, at 10:47 PM, Dave Wellman dwell...@ward-analytics.com wrote:
I need the values to be sequential.
Well… if your data set is as small as you mentioned (20 records or less)… you
could roll your own numbering schema with the simple expedient of attaching a
trigger to your tables
On 24 Jun 2014, at 9:47pm, Dave Wellman dwell...@ward-analytics.com wrote:
Included in that page is the following:
Note that monotonically increasing does not imply that the ROWID always
increases by exactly one. One is the usual increment. However, if an insert
fails due to (for example)
13 matches
Mail list logo