Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    Romania
    Posts
    70

    Unanswered: UPDATE without cursors

    Original Table

    Col_1 Col_2
    A
    A
    B
    A
    C
    B
    D
    B

    I want to obtain this

    Col_1 Col_2
    A 1
    A 1
    B 2
    A 1
    C 3
    B 2
    D 4
    B 2

    Is possible without use cursors ?

  2. #2
    Join Date
    Mar 2004
    Posts
    80

    Re: UPDATE without cursors

    Originally posted by Ovidiu
    Original Table

    Col_1 Col_2
    A
    A
    B
    A
    C
    B
    D
    B

    I want to obtain this

    Col_1 Col_2
    A 1
    A 1
    B 2
    A 1
    C 3
    B 2
    D 4
    B 2

    Is possible without use cursors ?
    update table tablename set col_2=ascii(col_1)-64

  3. #3
    Join Date
    Nov 2003
    Location
    Romania
    Posts
    70
    theguru, this is only an example.
    In real table col_1 contain data which is input by the users and the value is not A,B,C....., the real col_1 is with other values.

  4. #4
    Join Date
    Mar 2004
    Posts
    80
    Originally posted by Ovidiu
    theguru, this is only an example.
    In real table col_1 contain data which is input by the users and the value is not A,B,C....., the real col_1 is with other values.
    Take all the distinct col_1 values along with col_2 values to be assigned in a temp table,
    and update original table joining on col_1 of orginal and temp table.
    try this or could u plz send sample data so that i too can try it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •