RE: [sqlite] Multiple fields update

2007-08-06 Thread RB Smissaert
Yes, thanks, I just found out.
It can work without the WHERE clauses.

RBS


-Original Message-
From: Gerry Snyder [mailto:[EMAIL PROTECTED] 
Sent: 06 August 2007 21:59
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Multiple fields update

RB Smissaert wrote:
> I am sure this SQL used to be fine with SQLite:
>
> update table1
> set
> field1 = 0 where field1 = 2,
> field2 = 3 where field2 = 2
>
> Now however I get a syntax error near ,
>
> Has this changed?
>
>
> RBS
>   
Does the thread below ring a bell?  Does it help?

Gerry


---

Yes, thanks, that works indeed.

RBS

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: 11 March 2007 02:55
To: SQLite
Subject: [sqlite] Re: What is wrong with this UPDATE?

RB Smissaert <[EMAIL PROTECTED]>
wrote:

> > UPDATE
> > A3SQLADC_J
> > SET
> > ADDED_DATE = '' WHERE ADDED_DATE = 0 OR ADDED_DATE IS NULL,
> > START_DATE = '' WHERE START_DATE = 0 OR START_DATE IS NULL
> >
> > near ",": syntax error
>   

Make it

UPDATE
A3SQLADC_J
SET
ADDED_DATE = (case when ADDED_DATE = 0 OR ADDED_DATE IS NULL then '' 
else ADDED_DATE end),
START_DATE = (case when START_DATE = 0 OR START_DATE IS NULL then '' 
else START_DATE end);

Igor Tandetnik 





-
To unsubscribe, send email to [EMAIL PROTECTED]

-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Multiple fields update

2007-08-06 Thread Gerry Snyder

RB Smissaert wrote:

I am sure this SQL used to be fine with SQLite:

update table1
set
field1 = 0 where field1 = 2,
field2 = 3 where field2 = 2

Now however I get a syntax error near ,

Has this changed?


RBS
  

Does the thread below ring a bell?  Does it help?

Gerry

---

Yes, thanks, that works indeed.

RBS

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: 11 March 2007 02:55

To: SQLite
Subject: [sqlite] Re: What is wrong with this UPDATE?

RB Smissaert <[EMAIL PROTECTED]>
wrote:


> UPDATE
> A3SQLADC_J
> SET
> ADDED_DATE = '' WHERE ADDED_DATE = 0 OR ADDED_DATE IS NULL,
> START_DATE = '' WHERE START_DATE = 0 OR START_DATE IS NULL
>
> near ",": syntax error
  


Make it

UPDATE
A3SQLADC_J
SET
ADDED_DATE = (case when ADDED_DATE = 0 OR ADDED_DATE IS NULL then '' 
else ADDED_DATE end),
START_DATE = (case when START_DATE = 0 OR START_DATE IS NULL then '' 
else START_DATE end);


Igor Tandetnik 





-
To unsubscribe, send email to [EMAIL PROTECTED]
-