Thanks i will 

Kees Nuyt wrote:
> 
> On Wed, 6 Aug 2008 23:57:51 -0700 (PDT), you wrote:
> 
>>
>>In sqlite whether can we rotate content in database .
>>That means i want to restirct my database to some size,if it exceeds that
>>size it has to replace first entry.
>>Can anybody help.Thanks in advance
> 
> I had a similar requirement some time ago.
> This was my solution (it limits the number of rows in the
> table, not the size on disk, but in many implementations
> that is more or less equivalent):
> 
> CREATE TABLE jobs (
>       jobid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
>       jobprio   INTEGER  DEFAULT 9 
>               CONSTRAINT jobs_valid_prio
>               CHECK (jobprio > 0 AND jobprio < 10),
>       status    CHAR(1)  DEFAULT 'W' 
>               CONSTRAINT jobs_valid_status 
>               CHECK (status IN ('W','I','R','T','A','C')),
>       userid    VARCHAR(8) NOT NULL,
>       :
>       :
> );
> CREATE INDEX idx_jobs_tsn ON jobs(TSN);
> 
> CREATE TRIGGER jobs_ins AFTER INSERT ON jobs
> FOR EACH ROW BEGIN
>       DELETE FROM jobs WHERE jobid < (NEW.jobid - 9999);
> END;
> -- 
>   (  Kees Nuyt
>   )
> c[_]
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-rotate-content-in-database-in-sqlite-tp18865116p18885473.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to