#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    How would I have a field updated sequentially based on a defined where clause order


    I want to be able to update a field sequentially based on the order that it was put in the where in ('[john2].[john2]','[john3].[john3]','[john].[john]') clause but it does not appear to update based on its associated order (see SQL below).
    How would I have a field updated sequentially based on a pre-defined where clause order?

    John

    drop sequence temp_seq;
    create temp sequence temp_seq;

    update gis_field_configuration_bycube
    set seq_in_grid = nextval('temp_seq')
    where cube = 'Instruments' and level_unique_name in ('[john2].[john2]','[john3].[john3]','[john].[john]');
  2. #2
  3. Humble Learner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    280
    Rep Power
    119
    Instead of adding those strings in the IN clause, take those in a cursor and run the update by passing the values from the cursor. That will definitely help.

IMN logo majestic logo threadwatch logo seochat tools logo