|
senpoly
Starting Member
19 Posts |
Posted - 2007-08-06 : 09:54:30
|
| i am running the following sp alter PROCEDURE [dbo].[USP_LRPCONTAINERDETENTION_MAINEXE] @ChargeRunName VARCHAR( 25 ), @FROMDATE DATETIME, @TODATE DATETIME AS BEGIN SET NOCOUNT ON DELETE FROM GimDomContainers DELETE FROM DemurrageContainerMovement DELETE FROM DemurrageList DELETE FROM DemurrageListFinal SET NOCOUNT ON INSERT INTO DemurrageStatistics ( ChargeRun, ProcNo, StartTime ) VALUES ( @ChargeRunName, '1' , getDate() ) DECLARE @TODATE1 DATETIME SET @TODATE1 = DATEADD( DAY, 1 , @TODATE ) INSERT INTO GimDomContainers( EDISNO, ContainerNo, ActivityDate , MovementCode, Documentrefno, PortCode, CrDate ) SELECT edisno, containerno, activitydate, movementcode, documentrefno , portcode, crdate FROM cntrmovementdetail_mirror (nolock) WHERE ( crdate >= @FROMDATE and crdate < @TODATE1 ) and movementcode in ( 'GIM', 'DOM' )-- and delete from gimdomcontainers where edisno in ( SELECT EdisNo FROM lrpdemurrageedinos ) ----------------------------------------------------- INSERT INTO GimDomContainers( EDISNO, ContainerNo, ActivityDate , MovementCode, Documentrefno, PortCode, CrDate ) SELECT edisno, containerno, activitydate, movementcode, documentrefno , portcode, crdate FROM gimdomcontainers2delete from gimdomcontainers where edisno in ( SELECT EdisNo FROM lrpdemurrageedinos ) ----------------------------------------------------- INSERT INTO DemurrageContainerMovement( EdisNo, ContainerNo, MovementCode, ActivityDate, Documentrefno, VslCode, VslName, VoyCode, ServiceCode, Bound, PortCode, Depot, CarrierCode, Remarks, CrDate ) SELECT vc.edisno, vc.containerno, vc.movementcode, vc.activitydate, vc.documentrefno, vc.vslcode, vc.vslname, vc.voycode, vc.servicecode, vc.bound, vc.portcode, vc.depot, vc.carriercode, vc.remarks, vc.crdate FROM cntrmovementdetail_mirror vc (nolock) WHERE VC.ContainerNo = ( SELECT DISTINCT ContainerNo FROM GimDomContainers D WHERE D.ContainerNo = vc.ContainerNo AND VC.ActivityDate <= D.ActivityDate ) AND VC.EdisNo NOT IN ( SELECT EdisNo FROM lrpdemurrageedinos ) ----------------------------------------------------- UPDATE DemurrageStatistics SET EndTime = GetDate() WHERE ChargeRun = @ChargeRunName AND ProcNo = 1 ENDsometimes it runs finebut many times it shows the following errorMsg 0, Level 11, State 0, Line 0A severe error occurred on the current command. The results, if any, should be discarded.Msg 0, Level 20, State 0, Line 0A severe error occurred on the current command. The results, if any, should be discarded.on scrutinising it i found the actual error occurs when the following query runs inside the spINSERT INTO DemurrageContainerMovement( EdisNo, ContainerNo, MovementCode, ActivityDate, Documentrefno, VslCode, VslName, VoyCode, ServiceCode, Bound, PortCode, Depot, CarrierCode, Remarks, CrDate ) SELECT vc.edisno, vc.containerno, vc.movementcode, vc.activitydate, vc.documentrefno, vc.vslcode, vc.vslname, vc.voycode, vc.servicecode, vc.bound, vc.portcode, vc.depot, vc.carriercode, vc.remarks, vc.crdate FROM cntrmovementdetail_mirror vc (nolock) WHERE VC.ContainerNo = ( SELECT DISTINCT ContainerNo FROM GimDomContainers D WHERE D.ContainerNo = vc.ContainerNo AND VC.ActivityDate <= D.ActivityDate ) AND VC.EdisNo NOT IN ( SELECT EdisNo FROM lrpdemurrageedinos ) can any one suggest me, how can i solve this problem, please treat it as urgent, if it is not solved in a day, i have to look for a new jobregardssenthil |
|