Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Update with Case When



Permlink Replies: 14 - Last Post: Apr 9, 2018 8:54 PM Last Post By: marshal yadav Threads: [ Previous | Next ]
Melissa Torn

Posts: 143
Registered: 4/30/09
Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2018 12:14 AM
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You
Melissa Torn

Posts: 143
Registered: 4/30/09
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2018 3:32 AM   in response to: Melissa Torn in response to: Melissa Torn
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2018 10:27 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, you will have to do 2 updates, once for total < 0 and one for >=

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Melissa Torn

Posts: 143
Registered: 4/30/09
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2018 11:29 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Thank you so much Jeff,

No, you will have to do 2 updates, once for total < 0 and one for >=

Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 9:56 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, you will have to do 2 updates, once for total < 0 and one for >=

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 9:57 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, you will have to do 2 updates, once for total < 0 and one for >=

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 10:17 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, you will have to do 2 updates, once for total < 0 and one for >=

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 10:19 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, you will have to do 2 updates, once for total < 0 and one for >=

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 10:25 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No. You will have to do this as 2 SQL statements.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 15, 2018 11:03 AM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No. You will have to do this as 2 SQL statements.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 15, 2018 2:43 PM   in response to: Melissa Torn in response to: Melissa Torn
On 1/13/2018 6:33 AM, Melissa Torn wrote:
I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No. You will have to do this as 2 SQL statements.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 15, 2018 2:47 PM   in response to: Melissa Torn in response to: Melissa Torn
Melissa Torn wrote:

I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, this will have to be 2 different SQL statements.
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 15, 2018 2:48 PM   in response to: Melissa Torn in response to: Melissa Torn
Melissa Torn wrote:

I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, this will have to be 2 different SQL statements.
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 17, 2018 9:57 AM   in response to: Melissa Torn in response to: Melissa Torn
Melissa Torn wrote:

I am so sorry, i tried to post my message but
i received error message 4, 5 times (HTTP 505) and i thought
ı couldnt post my message, that is why my same
message appears 4 times

Melissa Torn wrote:
Is that possible to update a table with Case When
with a single Query without a S.Proc ?
Below query returns an error msg which is Token Unknown CASE

UPDATE MYTABLE
CASE
WHEN TOTAL < 0 THEN
SET CREDIT=TOTAL * -1 , TOTAL=TOTAL * -1 ELSE
SET CREDIT=TOTAL
END
DEBIT=0 WHERE TCODE='01'

Thank You

Edited by: Melissa Torn on Jan 13, 2018 12:33 PM

No, this will have to be 2 different SQL statements.
marshal yadav

Posts: 2
Registered: 5/10/18
Re: Update with Case When
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 9, 2018 8:54 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Beautiful page to the start it is so good freewsopchips.net
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02