November 27, 2017 at 6:00 am
Hi All,
I want my numbers to be converted from a column which is of nvarchar(100) datatype to decimal(18,2).
How can I correct it?
select CONVERT(DECIMAL(18,2),'129399389')
--I' am getting output as
129399389.00
But I am expecting output as
1293993.89
Thanks,
Sam
November 27, 2017 at 6:24 am
Thanks Thom.
November 27, 2017 at 7:34 am
vsamantha35 - Monday, November 27, 2017 6:00 AMHi All,I want my numbers to be converted from a column which is of nvarchar(100) datatype to decimal(18,2).
How can I correct it?select CONVERT(DECIMAL(18,2),'129399389')
--I' am getting output as
129399389.00But I am expecting output as
1293993.89Thanks,
Sam
There is nothing to correct. Datatype conversions do not perform arithmetical operations (though values may change due to rounding).
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 28, 2017 at 5:44 am
You might also want to consider what happens if your nvarchar(100) column contains more than 16 digits.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply