Update field conditionally

2004-03-09 Thread Terry Riley
Using v4.0.15 on WinNT under Apache. For my sins, the client has insisted on creating a page counter! The fields are to be CounterCode (Varchar 10), CounterValue (Int 10) and CounterStartDateTime (DateTime). Setting up the table is no problem. However, client wants to have the

Update field conditionally

2004-03-09 Thread Jeremy March
UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime = (IF CounterStartDateTime IS NULL, Now()) without success. It looks like you just have the syntax wrong. Try: UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime = IF(CounterStartDateTime IS NULL,

Re: Update field conditionally

2004-03-09 Thread Rhino
. ... etc. Just my two cents worth Rhino - Original Message - From: Terry Riley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 12:11 PM Subject: Update field conditionally Using v4.0.15 on WinNT under Apache. For my sins, the client has insisted on creating a page

Re: Update field conditionally

2004-03-09 Thread Terry Riley
Thanks, Jeremy What I actually needed was: UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime = IF(CounterStartDateTime IS NULL, Now(), CounterStartDateTime) This prevents it going back to NULL if the value is already not NULL. Thanks again. Terry --Original

Re: Update field conditionally

2004-03-09 Thread Richard Davey
Hello Terry, Tuesday, March 9, 2004, 5:11:00 PM, you wrote: I know you have some solutions to the original problem already, but I just wanted to make one small observation: TR The fields are to be CounterCode (Varchar 10), CounterValue (Int 10) and TR CounterStartDateTime (DateTime). Using a

Re: Update field conditionally

2004-03-09 Thread Terry Riley
Message - From: Terry Riley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 12:11 PM Subject: Update field conditionally Using v4.0.15 on WinNT under Apache. For my sins, the client has insisted on creating a page counter! The fields are to be CounterCode

Re: Update field conditionally

2004-03-09 Thread Terry Riley
See below: --Original Message- Hello Terry, Tuesday, March 9, 2004, 5:11:00 PM, you wrote: I know you have some solutions to the original problem already, but I just wanted to make one small observation: TR The fields are to be CounterCode (Varchar 10), CounterValue

Re[2]: Update field conditionally

2004-03-09 Thread Richard Davey
Hello Terry, Tuesday, March 9, 2004, 6:25:00 PM, you wrote: TR Good point, Richard. I was perhaps in a little bit too much of a hurry TR putting that together, and didn't even consider that! No worries. One other thought that occurred to me that might help with the original problem is as

Re[3]: Update field conditionally

2004-03-09 Thread Terry Riley
Hello Terry, Tuesday, March 9, 2004, 6:25:00 PM, you wrote: TR Good point, Richard. I was perhaps in a little bit too much of a hurry TR putting that together, and didn't even consider that! No worries. One other thought that occurred to me that might help with the original