Insert not working for certain date field - no error msg

  • I am executing the following stored procedure and it's all working except 2 date field inserts.  The odd thing is, if I change those date fields to other date fields, the other date fields DO get updated.  I checked the properties on the date fields that are working against the ones that aren't and can't find any differences.  The beginning of this code is working, but the active date update and the Date Assigned to FSR date update.

    If @status = 'Closed'

     Begin

     Update Customers Set cuStatus = @status, cuDisposition = @DispositionCode, cuOCBDate = @CBDate, cuClosedDate = getdate()

     Where cuID = @CustomerID

     

     If (Select cuActiveDate from Customers where cuID = @CustomerID) is null

      Begin

      Update Customers Set cuActiveDate = getdate()

      Where cuID = @CustomerID

      End

     End

     /*Update Open Date*/

    Else If @status = 'Open'

     Begin

     Update Customers Set cuStatus = @status, cuDisposition = @DispositionCode, cuOCBDate = @CBDate, cuActiveDate = getdate()

     Where cuID = @CustomerID

     End

     /*Update  Date Assigned to FSR*/

    If @DispositionCode < 400 and (Select cuDateAsn from Customers where cuID = @CustomerID) is null

     Begin

     Update Customers Set cuDateAsn = getdate()

     Where cuID = @CustomerID

     End

     /*Update Source*/

    Any ideas on why some date fields are getting updated and some aren't?

  • May the status is closed and there is active customer data for that customer

    Shas3

  • Yes.  All criteria is met.  It executes fine in Query Analyzer, just won't do it when the proc is executed from the app.  It does work if I change the active date to closed date or some other date field.

  • Check the update permissions on those date fields that are not updating

Viewing 4 posts - 1 through 3 (of 3 total)

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