|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2011-12-07 : 16:00:40
|
| Hi AllI am trying to insert the data by using below query INSERT INTO [dbo].[Enrollment]([SubID],[LineContractNbr],[LineContractIndex],[AnshinPlusID],[ContractCompanyCd] ,[SubscriberNbr],[LineContractDt],[PostalCd],[SubscriberType],[SubscriberDOB],[EnrollDt],[CancelDt],[HandsetCd],[HandsetName],[ManufNbr] ,[POSCd],[POSExtendedCd],[POSName],[PurchaseDt],[ContractDt],[MailDt],[WarrantyActivationDt],[AddresseeIdentifier],[RestartDt],[DataCreateDttm] ,[Active],[Source],[LoadKey],[FDate],[ClientId],[ClientProgramID],[EnrHash],[MarketID],[Status],[InsertDttm],[UpdateDttm],[ReportingPointer] ,[CountryID],[MiscUseI1],[MiscUseI2],[MiscUseC1],[MiscUseC2],[EditFlag],[AsurionSKU],[CommittedPOSCode],[CommittedPOSExtendedCode] ,[CommittedPOSName],[AppliedPOSCode],[AppliedPOSExtendedCode],[AppliedPOSName],[ServicePlan],[OrderType],[ServicePlanName],[Course] ,[ContractType],[MiniSimFlag],[UIMCardVersion],[HandsetRegistrationDt],[KHPointUsedDt],[CourseStartDt],[RecID]) SELECT [SubID],EB.[LineContractNbr],[LineContractIndex],[AnshinPlusID],[ContractCompanyCd] ,[SubscriberNbr],[LineContractDt],[PostalCd],[SubscriberType],[SubscriberDOB],[EnrollDt],[CancelDt],[HandsetCd],[HandsetName],[ManufNbr] ,[POSCd],[POSExtendedCd],[POSName],[PurchaseDt],[ContractDt],[MailDt],[WarrantyActivationDt],[AddresseeIdentifier],[RestartDt],[DataCreateDttm] ,[Active],[Source],[LoadKey],[FDate],[ClientId],[ClientProgramID],[EnrHash],[MarketID],[Status],[InsertDttm],[UpdateDttm],[ReportingPointer] ,[CountryID],[MiscUseI1],[MiscUseI2],[MiscUseC1],[MiscUseC2],[EditFlag],[AsurionSKU],[CommittedPOSCode],[CommittedPOSExtendedCode] ,[CommittedPOSName],[AppliedPOSCode],[AppliedPOSExtendedCode],[AppliedPOSName],[ServicePlan],[OrderType],[ServicePlanName],[Course] ,[ContractType],[MiniSimFlag],[UIMCardVersion],[HandsetRegistrationDt],[KHPointUsedDt],[CourseStartDt],[RecID] FROM [dbo].[Enrollment_Base] EB (NOLOCK) JOIN Stage.LCNsToReprocess R (NOLOCK) ON EB.LineContractNbr=R.LineContractNbrBut this is throwing me errorMsg 2627, Level 14, State 1, Procedure IJEnrollDataCorrection, Line 42Violation of PRIMARY KEY constraint 'PK_Enrollment'. Cannot insert duplicate key in object 'dbo.Enrollment'.The statement has been terminatedSubID is a primary key in 'dbo.Enrollment' table and this table is having 41367783 records already .My problem is that I need to find out that records which is being inserted 'dbo.Enrollment' table due to that error is occurring .Please let me know how can i find out that record.ThanksVIjay sahu |
|