Skip to content
Advertisement

Error converting data type nvarchar to numeric convert/cast

I suspect this has to do with reporting ClientName, which is a nvarchar data type. AUMid is nchar. I’m not sure how to work around this without changing the data types (which I prefer not to).

I need to display Clients.ClientName. It is linked to the AUM table via AUM.AUMid.

Removing SUM(AUM.AUM * AUM.ManagementFee) AS Management_Fee allows the query to execute.

Advertisement

Answer

This is clearly causing your error:

because AUM.AUM is a string. That seems like a really bad choice of data types if you want to store a number. However, I suspect that you really just want a direct sum:

On the other hand, the issue may be that AUM is a comma-separated list of numbers. If that is the case, my first and most sincere advice is to fix the data model. If you cannot do that for some reason, you can parse the string and keep your fingers crossed that it works:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement