Updating Temp Tables

  • This problem has me stopped.  Short test apps written to test my ability to update these temp tables are positive but my app doesn't seem to work the same way.

    My application uses two different stored procedures to update a schedule.  The first proc builds a temp table called ##sched and populates it with information.  The second is designed to update the SchedStart and SchedFinish dates and return control to proc #1 where the updated dates are used to update the table.  This allows me to display the table values during development to ensure they are correct before updating the database.  However, proc #2 does not seem to be updating the table correctly.  Debug seems to indicate these values should be updating when I run them in query analyzer.  Even print statements fire to indicate they are updated but a select of the temp table in proc #1 indicates otherwise.  Any help resolving this problem would be appreciated.

    Proc #1 table

    CREATE TABLE ##sched

     (

     ID int IDENTITY (1, 1),

     Type int,

     LruID int,

     Rank int,

     EventID int,

     PprComp int,

     PprDef int,

     PprDef_Cust int,

     [Red Parts] varchar(25),

     RedParts int,

     evtDura float,

     CalcDura float,

     SchedStart datetime,

     ActualStart Datetime,

     SchedFinish datetime,

     ActualFinish datetime,

     BestDate datetime,

     Resched int DEFAULT 0

    &nbsp

    Proc #2 update statement

      UPDATE ##sched SET SchedStart=@SchedStart,

       SchedFinish=@SchedFinish

      FROM ##sched

      WHERE EventID=@EventID And LruID=@LruID

      SELECT @ErrNbr=@@ERROR, @RowCount=@@ROWCOUNT

      IF @ErrNbr > 0

      BEGIN

       PRINT 'ERROR in spGetScheduleDates_New'

       RETURN

      END

      ELSE 

      IF @ErrNbr = 0

       PRINT 'UPDATED LruID='

        + CAST(@LruID As varchar(25))

        + ' EventID=' + CAST(@EventID As varchar(25))

        + ' to ' + CAST(@SchedStart AS varchar(25))

      END

  • Does the update work in QA?

  • I have the dates updating in QA now and I'm working on getting the correct dates.  Thanks for your interest.

  • What are you having problems with?

  • Nothing.  I stayed with it until solved.  It works fine now.

  • Happy to hear that.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply