Dynamic sql not working either null or error converting nvarchar to float
I am trying to load a table value into a variable. I am doing it dynamically because that table could have 1-5 variables to load. I either get a null value in my select statement or I get error converting nvarchar to float. Or I get fields don’t exist because I have an if statement on what to do if there are 2, 3, 4, and 5 variables, but those fields don’t exist in the table all the time, so it doesn’t like that version either. Currently the balance1 table has 1 row with total, adjfield1, adfield2. and the entry looks like this Total 27995.2200000031 27995.2200000031