Currently I have a working To_Char in Oracle:
To_Char($Num,'FM' || RPAD(RPAD(LPAD(LPAD('.',least($intmaxlength,$intminlength)+1,'0'),$intmaxlength+1,'9'),$intmaxlength+1+$decminlength,'0'),$intmaxlength+1+$decmaxlength,'9'))
My goal is to convert a number to a string, fitting into four parameters for integers and decimals.
I would like to add minimum and maximum precision. For example, the integers to the left of the decimal point in 1234567.89 should have a minimum of 1 but a maximum of five (so the extra integers would be trimmed). In addition, I'd like to do the same for scale - the decimals to the right, by setting a minimum of two decimal places and a maximum of four. These numbers are just examples, the numbers will be updated dynamically.
I have minimal experience in MSSQL, but from what I can see some equivalent functions like Least are missing in it versus Oracle.