Add/Remove Records from T_CUST_PREM?

Hello Tessitura Community!

We want to use the premium functionality to track our corporate sponsorship comp ticket benefit use.  We're trying to create a stored procedure that will update the T_CUST_PREM table based on ticket purchases and returns for the corporate sponsor ticket price type.

Has anyone successfully added records to or deleted records from this table using a custom stored procedure?  We're specifically stuck on auto incrementing the cust_prem_no (PK) field.  We successfully manually inserted values (including the cust_prem_no field) into the table and we know that numbers are not reused even when a record has been deleted from the table.  However, we do not know what table to query in our procedure in order to maintain the integrity of the sequential numbering system for T_CUST_PREM.

Any help or pointing in the right direction would be greatly appreciated!

Thank you!

Mandy

  • If you manually assign new cust_prem_no, you are putting the table out of sync with T_NEXT_ID, which means the next time you try to add a row manually in the client, you will likely have a primary key constraint issue.

    When inserting new rows, you retrieve the next ID for cust_prem_no by calling 

    EXEC dbo.AP_GET_NEXTID_function @type = 'CP', @nextid = @next_id OUTPUT
    You can do this in a cursor or while loop to get a separate value for each row, or you can do it in bulk by using the @increment parameter and then sequentially numbering your insert over that increment starting from the returned next_id value.
  • Hi Nick,

    Thank you for such a quick reply!  T_NEXT_ID + the related function is what I was missing - I knew that something needed to be called in order to increment it, just wasn't sure what it was called.  I'll give this a try!  Thank you so much!

    Mandy Slight smile