string or binary data truncated error in procedure please help me on this
Please refer the below statement where I am getting the eror like Msg 8152, Level 16, State 13, Procedure sp_Org_Master, Line 209 String or binary data would be truncated. Please refer below the double quoted line is showing the error UPDATE xxx SET xxx.[IsInFactory] = 1, xxx.[FAC_isMerged] = mss.[IsMerged], xxx.[FAC_TPID] = mss.[TPID], xxx.[FAC_SubSegmentID] = mss.[EndCustomerSubSegmentID], xxx.[FAC_VerticalCategoryID] = mss.[VerticalCatID], --xxx.[FAC_FY_TPID] = ss.FinalTPID, -- recommended value xxx.[FAC_FY_SubSegmentID] = mss.[SubSegmentAltID], xxx.[FAC_FY_VerticalCategoryID] = mss.[VerticalCategoryAltID], xxx.[FAC_IsFYTopParent] = (CASE WHEN mss.[IsFYTopParent] = 'Yes' THEN 1 ELSE 0 END), ----- missing geo & name xxx.[SubsidiaryId] = COALESCE(xxx.[SubsidiaryId], mss.[WWSubsidiaryID]), xxx.[CountryID] = COALESCE(xxx.[CountryID], mss.[EndCustomerCountryID]), xxx.[OrgName] = COALESCE(xxx.[OrgName], mss.[OrgName]) FROM [audit].[t_Org_Master_staging] AS xxx "JOIN [DW].[FAC].[t_MSSInfo] AS mss (NOLOCK)" ON mss.[MSSID] = xxx.[OrgID] AND mss.[OrgTypeID] = 7 AND mss.[IsInternalOrg] = 0;
I'm guessing that isn't the line causing the issue. That error is stating that one of the source values is larger than the destination column can hold, which would result in SQL Server truncating the value. I'd look at those two tables to see if one of the destination columns (audi.t_org_master_staging) is smaller than one of the source columns.