Puneet Kishor wrote:
I am jumping in the middle here, but...

Mark de Vries wrote:

On Thu, 18 Aug 2005, Kurt Welgehausen wrote:


Is it possible to change the values of certain rows that
are inserted into the database? ...


I think everything you need is explained at

   <http://www.sqlite.org/lang_createtrigger.html>.



Yeah, I've read it.


If you don't understand how to get the current date in
SQLite, look at the wiki page.



This too.

But I still don't know how to do what I want to do. Perhaps I need to
explain with a litle more detail what I mean. Consider the following
table.

create table foo (
  value TEXT,
  date_create TEXT,
  date_lch TEXT
);

Now, whenever I insert into this table I want to set date_create to
CURRENT_TIMESTAMP.



Set DEFAULT CURRENT_TIMESTAMP above for date_lch
                                          ^^^^^^^^

/date_lch/date_create/

You know what I mean ;-)




CREATE TABLE foo (
  value TEXT,
  date_create DATETIME DEFAULT CURRENT_TIMESTAMP,
  date_lch DATETIME
);


Whenever I update a row I want date_lch (lch=last change) to be set to
CURRENT_TIMESTAMP. (Changes to the date_create col should be (silently)
'ignored'.


Don't include the date_create column in the UPDATE statement.

UPDATE foo
SET value = 'whatever', date_lch = 'current datetime value'
WHERE your constraint

What's the problem?

Reply via email to