Calculated Field convert NVARCHAR to Decimal

Creating a calculated field

convert(decimal,Part.Specification)

Text: Error converting data type nvarchar to numeric

What is my issue?

your type (the dropdown above) is set to nvarchar. If you want it to be a decimal, change it to decimal.

This is making some assumptions, but you didn’t really give a lot of into. Like when or where you are seeing the error. Include some screen shots. That helps a lot so that other can understand some context.

Do you get the error when you run the query? Or when you check the syntax?

When I run the query I receive.28

there is data in the table that can’t be converted to a decimal. Check the data in there as just a regular view.

If you want it to be a decimal, you’re going to have to clean up the data, and keep in clean.

1 Like

What is it you are trying to do? That’s a character field, why do you want it decimal?

Maybe blank or null too.

3 Likes

How to deal with Null or Blank data?

isnull(expression,0)

Honestly though. Use a decimal field. It will be way easier.

2 Likes

ROUND(Part.Specification,2)*PartCost.LastMaterialCost

Adding ROUND( at the beginning fixed the formula

thanks all

2 Likes