I have a data column that stores products distribution units as 1*1 or 1*2*6. I want to formulate a computed column and have the result of the multiply problem.
below is illustrated example
sku du computed_du
12345678 1*2 2
12345679 1*3 3
12345680 1*6*2 12
Is there a most effective way to perform this calculation on sql server?
This is definitely something that should be calculated elsewhere, but I have seen the below technique used as a crude product aggregation.
I am not positive about using this for computed column, but here is how you might pull it off: Wrap this in a function, schema bind it to your table, and reference it the computed column definition (not sure if mssql will allow this due to deterministic requirement of udf).
Uses split function from here.