[EMAIL PROTECTED] wrote:
Hi Morten,
Thanks for the help. I got the idea for doing this based on the trigger. I
shall implement the same. Thanks once again for the help.
Regards,
Sankara Narayanan B
morten bjoernsvik <[EMAIL PROTECTED]>
02/17/2005 03:06 PM
Please respond to
sqlite-users@sqlite.org
To
sqlite-users@sqlite.org
cc
Subject
Re: [sqlite] Re: AUTOINCREMENT Functionality by default required in 3.0.8
(Is it possible?)
Hi
You can easily fix this trick with the "insert null to
and integer primary key" trick or by using a trigger.
Use a reference value you either increase or decrease,
or count to set for new values.
% cat /data/temp/test.sql
.header on
create table test (
num integer,
num2 integer,
info text,
primary key (num)
);
create trigger total_num_for_test after insert on test
begin
update test set num2 = (
select count(*) from test
) where num=new.num;
end;
insert into test (num,info) values (null,'number
one');
insert into test (num,info) values (null,'number
two');
insert into test (num,info) values (null,'number
three');
select num,info,num2 from test;
% sqlite3 test.db < /data/temp/test.sql
num|info|num2
1|number one|1
2|number two|2
3|number three|3
%
--
MortenB
--- [EMAIL PROTECTED] skrev:
Hi,
A soft reminder. Please inform if the below
mentioned request is a
possibility?
Regards,
Sankara Narayanan.
what happens If you do:
delete from test where num = 2;
insert into test (num, info) values(null, 'number four');
Wouldn't you have:
num|info|num2
1|number one|1
3|number three|3
3|number four|3
John LeSueur