Convert NVARCHAR to NUMERIC

Asked

Viewed 275 times

0

I have a table that has a VALUE column, but the column is in nvarchar, this column nvarchar does not let me do the correct formatting in the report I am using select.

I can do the conversion in SQL Server to type money, but it is not in the correct pattern. Inside Visual Studio I used converters that also do not work properly.

Example, in the table if it has the value 2952.20 making the conversion to money is 295220.00 that it is wrong. In more type, shows the error message that nvarchar cannot convert to numeric type.

The conversion methods I used in SQL:

CAST(ISNULL(VALOR,0) as MONEY) as VALOR

COVNERT(MONEY, ISNULL(VALOR,0)) as VALOR

Have some kind of treatment I need to do to convert nvarchar field to some kind of numeric form correctly?

  • The value in the table actually has a POINT - 2952 . 20? Using a convert with point, it should work normally, but, if it is a comma, then it will be wrong as said.

  • @Ismael really was my fault in confusing the point with the comma. I did the replace comma per point worked normally.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.