Вы также можете попробовать разделить, просто создав значение с помощью функции REPLICATE()
.
CREATE TABLE Data (id int, AmountPrecision int)
INSERT INTO Data (id, AmountPrecision) VALUES
(1, 1)
, (51, 1)
, (51, 2)
, (934, 3)
, (1024, 2)
Select id
, Cast('1' + REPLICATE('0', AmountPrecision) as int) as DivideBy
, Cast(id * 1.0 / Cast('1' + REPLICATE('0', AmountPrecision) as int)
as float) as FormattedNumber
from Data
Live db <> fiddle demo.