
Tom Cooper 8,441 Reputation points
20220502T15:08:47.33+00:00 If you are converting it to decimal(38, 30). It is trying to convert it to a decimal with 8 digits to the left of the decimal point and 30 digits to the right of the decimal point. Which means any number greater than or equal to 100,000,000 or less than or equal to 100,000,000 would give you that error. And, of course, your float value of 1.369258488045704E+15 is much less than that range.
Since you say you only want two decimals, try converting it to decimal(38, 2). That should fix your problem.
Tom
My guess is that the type of the column you are converting is not a float, but in fact is a character string. If that is true, then you must convert it to float and then to decimal, for example
Declare @Sample Table(FloatColumn varchar(225));
Insert @Sample(FloatColumn) Values
('0'),
('1.369258488045704E+15');
Select FloatColumn, Cast(Cast(FloatColumn As float) As decimal(35,17)) As DecimalColumn
From @Sample;
If that is not what is going on, please give us some sample data in the form of Create Table or Declare Table and Insert Statements like I did above. Also if you are receiving an error message give us the exact error message.
Tom