Clever Code or Foolish Functions?

In an attempt to be more efficient (and because I apparently have the short-term memory of a goldfish) I've developed some code to go at the end of my procedure for adding new login accounts for T_CUST_LOGIN while tending to the T_NEXT_ID table that I always seem to forget to update.  The code is as follows:

UPDATE T_NEXT_ID
SET T_NEXT_ID.next_id = (select max(eaddress_no) from T_EADDRESS)
where T_NEXT_ID.type='AD' and (select next_id from T_NEXT_ID where type='AD') <> (select max(eaddress_no) from T_EADDRESS)

What do you think, Tessiturians?  It should work, right?

BONUS ICHTHYOCENTRIC TRIVIA: The oldest recorded age of a goldfish is 41.

Parents
  • Be careful with the Type = 'AD' and max from t_Eaddress since I believe "AD" is used on the T_Address also.

     

     

     

     

    Marty Jones

    Database Administrator

     

    Omaha Performing Arts
    1200 Douglas Street

    Omaha, Nebraska 68102

    P 402.661.8469  |  F 402.345.0222    

    Marty.Jones@omahaperformingarts.org

    www.omahaperformingarts.org

    For tickets, call Ticket Omaha at 402.345.0606

     

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Matt Gonzales
    Sent: Tuesday, June 08, 2010 12:06 PM
    To: Martin A. Jones
    Subject: [Tessitura Technical Forum] Clever Code or Foolish Functions?

     

    In an attempt to be more efficient (and because I apparently have the short-term memory of a goldfish) I've developed some code to go at the end of my procedure for adding new login accounts for T_CUST_LOGIN while tending to the T_NEXT_ID table that I always seem to forget to update.  The code is as follows:

    UPDATE T_NEXT_ID
    SET T_NEXT_ID.next_id = (select max(eaddress_no) from T_EADDRESS)
    where T_NEXT_ID.type='AD' and (select next_id from T_NEXT_ID where type='AD') <> (select max(eaddress_no) from T_EADDRESS)

    What do you think, Tessiturians?  It should work, right?

    BONUS ICHTHYOCENTRIC TRIVIA: The oldest recorded age of a goldfish is 41.




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Reply
  • Be careful with the Type = 'AD' and max from t_Eaddress since I believe "AD" is used on the T_Address also.

     

     

     

     

    Marty Jones

    Database Administrator

     

    Omaha Performing Arts
    1200 Douglas Street

    Omaha, Nebraska 68102

    P 402.661.8469  |  F 402.345.0222    

    Marty.Jones@omahaperformingarts.org

    www.omahaperformingarts.org

    For tickets, call Ticket Omaha at 402.345.0606

     

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Matt Gonzales
    Sent: Tuesday, June 08, 2010 12:06 PM
    To: Martin A. Jones
    Subject: [Tessitura Technical Forum] Clever Code or Foolish Functions?

     

    In an attempt to be more efficient (and because I apparently have the short-term memory of a goldfish) I've developed some code to go at the end of my procedure for adding new login accounts for T_CUST_LOGIN while tending to the T_NEXT_ID table that I always seem to forget to update.  The code is as follows:

    UPDATE T_NEXT_ID
    SET T_NEXT_ID.next_id = (select max(eaddress_no) from T_EADDRESS)
    where T_NEXT_ID.type='AD' and (select next_id from T_NEXT_ID where type='AD') <> (select max(eaddress_no) from T_EADDRESS)

    What do you think, Tessiturians?  It should work, right?

    BONUS ICHTHYOCENTRIC TRIVIA: The oldest recorded age of a goldfish is 41.




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Children
No Data