question

tstrole avatar image
tstrole asked

Imported DB2 decimal(13,4) with negative values

Hello - How do I import negative decimals from DB2 into SQL Server 2012? The data types on both sides are decimal(13,4), but when I use the import wizard or an simple insert into statement with OPENQUERY, the error returned I 'String or binary data would be truncated'. I isolated this to the column that returns the negative sign in the output. Thank you, Tammy
decimalimport-export-wizard
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JohnM avatar image
JohnM answered
The minus sign shouldn't be an issue and is not included in the space requirements for the data type specified as far as I'm aware. My guess is that there is something else that is being truncated. Can you post the query? This works. It has 13 digits total and 4 decimal places. DECLARE @x DECIMAL(13,4) = -123456789.1234 SELECT @x
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.