Pages

Sep 13, 2017

Msg 8152, Level 16, State 13, Line 27 Error when insert into SQL table from another object of SQL or from Oracle using linked server.

Msg 8152, Level 16, State 13, Line 27
String or binary data would be truncated.
The statement has been terminated.



Cause: Inserting bigger value than the declared size.

Fix: Find the column, which is error out, compare with the source column size, and increase it in the destination object. Try again inserting the data.

To find the problematic column try inserting small subset by keep adding the additional columns. That is the easy way to troubleshoot.

INSERT INTO [dbo].[TestSummary]
           ([PrimaryID]
           ,[Organization]
           ,[SubLineStatusCode]
           ,[OrganizationID]
           ,[ContractNumber]
           )
     SELECT * FROM OPENQUERY(NHRTEST,'SELECT PRIMARY_ID,
ORGANIZATION,
SUB_LINE_STATUS_CODE,
ORGANIZATION_ID,
CONTRACT_NUMBER,
FROM APPS.XXNHR_SERVICE_CONTRACT_V')

No comments: