A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
What is the error (number and message)?
We don't have access to your table definitions and data, so we cannot replicate the issue.
My guess is that the varchar column container other than numeric data.
You can find them by using
WHERE TRY_CAST([yourVarcharCol] as float) IS NULL
TRY_CAST documentation:
https://learn.microsoft.com/en-us/sql/t-sql/functions/try-cast-transact-sql?view=sql-server-ver15