Jean-Christophe Deschamps-3 wrote:
>
>
>>My date column is set when the program starts and i do not want it to
>>change.
>
> How is this date column set in the database without inserting anything?
>
>> So I have my <dbname> with <mytable> and two columns <date> and
>><value column>. I have say 5 values (1 2 3 4 5) that I wanted inserted
>>into mytable where the date is equal to date that was preset my
>>starting the
>>program.
>
> Preset, how? I guess you have this date stored in some variable
> somewhere. Just use it to fill the date column in the each new row.
>
>> So a select of my table would look like this:
>>select * from mytable where date='2011/04/18 21:35:33';
>>2011/04/18 21:35:33|1
>>2011/04/18 21:35:33|2
>>2011/04/18 21:35:33|3
>>2011/04/18 21:35:33|4
>>2011/04/18 21:35:33|5
>
> So you need to perform as many inserts as values you have to insert:
> insert into mytable (date, value) values ('2011/04/18 21:35:33', 1);
> insert into mytable (date, value) values ('2011/04/18 21:35:33', 2);
> insert into mytable (date, value) values ('2011/04/18 21:35:33', 3);
> insert into mytable (date, value) values ('2011/04/18 21:35:33', 4);
> insert into mytable (date, value) values ('2011/04/18 21:35:33', 5);
>
> If you have really _many_ inserts to perform, wrap the lot in a
> transaction to speed up the process:
> begin;
> <massive inserts>
> commit;
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
that worked perfect. thanks for the help. Do you think a join would be
better then a insert?
--
View this message in context:
http://old.nabble.com/insert-help-tp31429185p31434954.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users