The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
Please vote in the Forum Structure Poll. Polling will close at 2PM EST on January 21, 2025.

DB2 SQL updates

DeebaserDeebaser on my way to work in a suit and a tieAhhhh...come on fucking guyRegistered User regular
edited August 2012 in Help / Advice Forum
I'm creating a report I previously created in sybase on a different DB2 system

In Sybase I have a lot of simple text updates like follows

UPDATE #deestable
SET Score_Rank = 1
WHERE score_txt = 'AWESOME'

So... I rewrite this simple update as best I can in DB2 syntax...

UPDATE SESSION.deestable tbl
SET (Rating_Rank) = 1
WHERE score_txt = 'AWESOME';

Predictably, I get an error about score_txt not being valid in the context where it is used.

Please help.
Fuck DB2

Deebaser on

Posts

  • BowenBowen Sup? Registered User regular
    Try:

    UPDATE SESSION.deestable SET Rating_Rank = 1 WHERE score_text = 'AWESOME';

    Any reason you're using an alias there?

  • DeebaserDeebaser on my way to work in a suit and a tie Ahhhh...come on fucking guyRegistered User regular
    Just habit, I have about 40 other updates that need it because putting SESSION.deestable in the FROM causes DB2 to bug out for some stupid reason.

    I tried your code, but Im still getting the same context error. :(

  • JdNoaJdNoa Registered User regular
    edited August 2012
    Any chance the column name was created case sensitive? From looking at this http://www.ibm.com/developerworks/data/library/techarticle/0203adamache/0203adamache.html#N10156 you could try

    UPDATE SESSION.deestable SET Rating_Rank = 1 WHERE "score_txt" = 'AWESOME';

    JdNoa on
  • BowenBowen Sup? Registered User regular
    Haha wow what.

  • DeebaserDeebaser on my way to work in a suit and a tie Ahhhh...come on fucking guyRegistered User regular
    Please close.
    I'm a dumb.

    "score_txt" on this database is actually "score_symbol_cd"

    Thanks all the same :)
    <3

Sign In or Register to comment.