As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

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

  • Options
    bowenbowen How you doin'? Registered User regular
    Try:

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

    Any reason you're using an alias there?

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    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. :(

  • Options
    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
  • Options
    bowenbowen How you doin'? Registered User regular
    Haha wow what.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    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.