Decimal Datatype with negative value

gussy81's profile image gussy81 posted 3 weeks ago in General Permalink

I have a strange one. I am using the datatype DECIMAL in my SQL table. like this:

DebtAmount DECIMAL(17,2) NULL

If I insert values like: 100 or 10.5 or -10 they insert no problem.

The problem I am having is loads of my data has negative values that have it like 200- or 350- (you see the minus sign at the end of the value instead of before it)

When i bring them into excel they come in no problem with the minus sign before the value but SQL does not like the minus figure after the value. i cant really do anything about how the values import from our system this way so i was hoping i could work with sql on this issue.

error i get is: Error converting data type varchar to numeric.



ansgar's profile image ansgar posted 2 weeks ago Permalink

Please post the server version. Probably this is already fixed in the latest release, as I cannot reproduce it here.

gussy81's profile image gussy81 posted 2 weeks ago Permalink

i have sorted this problem. i am storing the trailing minus value in a temp table as varchar and then inserting into the correct table after converting it to correct format i.e the minus sign before the value.

Please login to leave a reply, or register at first.