SQLTeam.com | Weblogs | Forums

Convert arthmetic formulae to sql code



i need to add sum and isnull to some string like below.

and this need to be done dynamically user only enter arthmetic string and i need to convert this into sql like code
please help

airthmetic formulae : col1/((col1+(col2-col3))/col4)
sqlcode : sum(isnull(col1,0)/((sum(isnull(col1,0))+(sum(isnull(col2,0))-sum(isnull(col3,0))))/sum(isnull(col4,0)) )