Yes, it is fine. Thanks very much.
2007/5/7, Mohd Radzi Ibrahim <[EMAIL PROTECTED]>:
How about this? update tablename set newcolname=(case rowid when 1 then 1 else 2 end); best regards, Radzi ----- Original Message ----- From: "Tomash Brechko" <[EMAIL PROTECTED]> To: <sqlite-users@sqlite.org> Sent: Saturday, May 05, 2007 8:09 PM Subject: Re: [sqlite] how to add a new column quickly > On Sat, May 05, 2007 at 19:30:59 +0800, ronggui wong wrote: >> Thanks. But there is no typo, what I want is a general solution. >> >> 2007/5/5, Tomash Brechko <[EMAIL PROTECTED]>: >> >On Sat, May 05, 2007 at 14:01:56 +0800, ronggui wong wrote: >> >> . update tablename set newcolname=1 where ROWID=1 >> >> . update tablename set newcolname=2 where ROWID=2 >> >> . update tablename set newcolname=2 where ROWID=3 > > If there is no correlation between newcolname and other columns that > can be expressed as a formula, but rather you want to set newcolname > to some known Func(ROWID), you may register this function with > sqlite3_create_function() (or its equivalent for your language > bindings), and then do a single statement > > UPDATE tablename SET newcolname = Func(ROWID); > > This will be faster then repeatedly searching for a row with a given > ROWID. > > > -- > Tomash Brechko > > ----------------------------------------------------------------------------- > To unsubscribe, send email to [EMAIL PROTECTED] > ----------------------------------------------------------------------------- > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------
----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------